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
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

For Loops which do not use an iterator Variable in the action: In all the illustrations that we seen so far, the value of the loop variable has been used in same way in the ac

Reading from a File in a While Loop: Though in most languages the combination of a loop and an if statement would be essential to determine whether or not the elements in a ve

Finding a sting - function strfind: The function strfind does necessarily similar thing, except that the order of the arguments does make dissimilarity. The common form is str

Algorithm for the function explaine: The algorithm for the function explaine is as shown:  Print a description of e, the exp function, and how to find the approximate va

Initializing the data structure - Function: Function is shown as:   >> printcylvols(cyls) Cylinder x has a volume of 169.6 Cylinder a has a volume of 100.5

Example of Gauss-jordan: For a 2×2 system, this would results and for a 3 × 3 system, Note that the resulting diagonal form does not involve the right-most col

Variable Scope: The scope of any of variable is the workspace in which it is valid. The workspace generated in the Command Window is known as the base workspace. As we know

Print from the structure: To print from the structure, a disp function will show either the whole structure or a field. >> disp(package) item_no: 123 cost: 19.99

Indexing into Vectors of structures: Frequently, when the data structure is a vector of structures, it is essential to iterate through the vector in order by various fields. F