Supplementary Lecture - Symbolic Function PDF

Title Supplementary Lecture - Symbolic Function
Author Chester Nathan
Course Trigonometry
Institution Mapua University
Pages 5
File Size 140.8 KB
File Type PDF
Total Downloads 85
Total Views 139

Summary

trigonometry...


Description

MATLAB Basics: Symbolic Function MATLAB Function sym

Definition and Use Construct symbolic numbers, variables and objects. constructs an object of class , from. 1. If the input argument is a string, the result is a symbolic number or variable. 2. If the input argument is a numeric scalar or matrix, the result is a symbolic representation of the given numeric values. 3. If the input is a function handle the result is the symbolic form of the body of the function handle. How to use the sym command: 1. creates the symbolic variable with name and stores theresult in x. 2. also assumes that x is real, so that is equal to x. 3. and ) are other examples. Similarly, makes a positive (real) variable. 4. restores x to aformal variable with no additional properties (i.e., insures that x is NEITHER real NOR positive).

syms

Short-cut for constructing symbolic variables. The MATLAB command is short-hand notation for creating symbolic variables

How to use the syms command: 1. is equivalent to: 2. 3.

is equivalent to: >> is equivalent

Symbolic Processing 1. Symbolic Processing is the process of obtaining answers in the form of expressions. It is the term used to describe how a computer performs operations or mathematical expressions in the way, for example that humans do algebra with pencil and paper. 2. Symbolic object is a data structure that stores a string representation of the symbol. The two ways to create symbolic object are: 

Using sym function creates the symbolic variable with name x.

MATLAB BASICS SUPPLEMENTARY LECTURE | Prepared by: Engr. Patricia Grace D. Marasigan



Using syms command syms x is equivalent to typing Typing syms x y z creates three symbolic variables x, y and z.

3. A symbolic variable containing a symbolic expression is automatically created from a symbolic expression whose variables were previously created. Activity 1. Type the following commands and explain the result.

______________________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________ 4. Functions for Manipulating Symbolic Expression MATLAB Function collect

Definition and Use Collects coefficients of like powers in the expression E. regards each element of the symbolic matrix S as a polynomial in v and rewrites S in terms of the powers of v. ) uses the default variable determined by SYMVAR. Use collect function to simplify the following expressions .

Use collect function to simplify the expression .

NOTE: using the command where is the given expression, variables is collected because it is the default independent variable. However, can be collected using the optional form ).

expand

Symbolic expansion. Expands the expression by carrying out powers. expand(S) writes each element of a symbolic expression S as a product of its factors. The command expand is most often used on polynomials, but also

MATLAB BASICS SUPPLEMENTARY LECTURE | Prepared by: Engr. Patricia Grace D. Marasigan

expands trigonometric, exponential and logarithmic functions. Use expand function to simplify the following

factor

poly2sym

x Factors the expression . Prime factors. returns a vector containing the prime factors of . Factor the following expression

Converts a polynomial coefficient vector p to a symbolic polynomial. The form generates the polynomial in terms of the variable . Convert the coefficient vector into symbolic polynomial.

NOTE: The form poly2sym(x, ‘y’) generates the polynomial in terms of y. For example,

pretty

Displays the expression on the screen in a form that resembles typeset mathematics.

simplify

Simplifies the expression using Maple’s simplification rules. Simplify the expression .

1

MATLAB BASICS SUPPLEMENTARY LECTURE | Prepared by: Engr. Patricia Grace D. Marasigan

subs

Symbolic substitution. The MATLAB command ) replaces OLD with NEW in the symbolic expression S. OLD is a symbolic variable, a string representing a variable name, or a string (quoted) expression. NEW is a symbolic or numeric variable or expression. Evaluate the expression using subs when x = 1.

sym2poly

Converts the expression to a polynomial coefficient vector. The function sym2poly(E) converts the expression E to a polynomial coefficient vector.

solve

Solving Algebraic and Transcendental Equations, solves a symbolic expression or equation represented by the expression E. If E represents an equation, the equation’s expression must be enclosed in single quotes. If E represents an expression, then the solution obtained will be the roots of the expression E; that is, the solution of the equation E = 0. You need not declare the symbolic variable with the sym or syms function before using solve.

Evaluate the following expression using the solve command.

-2 -1

-2 -1 You can also solve systems of equation using the format Evaluate the systems of equation

MATLAB BASICS SUPPLEMENTARY LECTURE | Prepared by: Engr. Patricia Grace D. Marasigan

1

4

MATLAB BASICS SUPPLEMENTARY LECTURE | Prepared by: Engr. Patricia Grace D. Marasigan...


Similar Free PDFs