Expanding a function, MATLAB in Engineering

Expanding a function:

The expand function will multiply out terms, and factor will do the opposite:

>> expand((x+2)*(x-1))

ans =

x^2 x-2

>> factor(ans)

ans =

(x 2)*(x-1)

 

The function subs will replace a value for the symbolic variable in an expression. For illustration,

>> myexp = x^3 + 3*x^2 - 2

myexp =

x^3 3*x^2-2

>> x = 3;

>> subs(myexp,x)

ans =

       52

 

With symbolic math, a MATLAB works by the default with rational numbers means that the outcomes are kept in fractional forms. For illustration, executing the addition 1/3 + 1/2 would generally answer in a double value:

>> 1/3 + 1/2

ans =

       0.8333

Though, by making the expression symbolic, the outcome is symbolic also. Any numeric function (example, double) could modify that:

>> sym(1/3 + 1/2)

ans =

5/6

>> double(ans)

ans =

       0.8333

 

Posted Date: 10/22/2012 4:36:13 AM | Location : United States







Related Discussions:- Expanding a function, Assignment Help, Ask Question on Expanding a function, Get Answer, Expert's Help, Expanding a function Discussions

Write discussion on Expanding a function
Your posts are moderated
Related Questions
Application: Menu driven Modular Program Numerous longer, more involved programs which have interaction with the user are menu-driven, that means that the program prints a men

Gauss Elimination: The Gauss elimination technique consists of:    Generating the augmented matrix [A b]    Applying EROs to augmented matrix to obtain an upper trian

Illustration of Matrix solutions: For illustration, consider the three equations below with 3unknowns x 1 ,x 2 , and x 3 : We can write this in the form Ax = b here A

Use of built-in colormaps: MATLAB has built-in colormaps, it is also possible to generate others by using combinations of any colors. For illustration, the following generates

Set Operations: The MATLAB has numerous built-in functions which perform set operations on vectors. These involve intersect, union, setdiff, unique, and setxor. All these func

Illustration of Passing arguments to functions: Here is an illustration of calling this function: >> printrand() The random # is 0.94 As nothing is passed to

Example of Exponential function modular program: In order to view the distinction in the approximate value for e as n increases, the user kept choosing Limit & entering larger

Function used in sound files: The MATLAB has numerous other functions which let you read and play sound or audio files. In the audio files, sampled data for each audio channel

Illustration of anonymous functions: Dissimilar functions stored in the M-files, when no argument is passed to an anonymous function, the parentheses should still be in the fu

I have a vector of X, one for Y , one for x-direction velocity U and one for y-direction velocity V. they are at same size. How can I plot streamline of that flow? I follow all exa