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 =



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 =


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 =


>> double(ans)

ans =



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
Gauss-Jordan: The Gauss-Jordan elimination technique begins in similar way which the Gauss elimination technique does, but then rather than of back-substitution, the eliminati

Logical scalar values: The MATLAB also has or and and operators which work element wise for the matrices: These operators will compare any of the two vectors or matric

Example of image processing: The other illustration generates a 5 × 5 matrix of arbitrary integers in the range from 1 to the number of colors; the resultant image is as shown

analyzing traffic; determine motion of flow; calculate tracklets; detect abnormalities;

Illustration of gauss-jordan elimination: An illustration of interchanging rows would be r1 ¬→ r3, that would results: Now, beginning with this matrix, an illustration of sc

Individual structure variable: The individual structure variable for one software package may look like this: The name of the structure variable is a package; it has f

Example of Menu driven modular program: As an illustration of such a menu-driven program, we will write a program to discover the constant e. The constant e, known as the n

Uses of Function handles: The Function handles can also be generated for functions other than anonymous functions, both built-in & user-defined functions. For illustration, th

Creating Cell arrays: There are many ways to create cell arrays. For illustration, we will create a cell array in which one element will store an integer, one element store ch

Illustration of Sound files: For illustration, the following script generates a subplot which shows the signals from chirp and from train, which is as shown in figure: