Wednesday, May 12, 2010

MATLAB Basics Algebra

Using MATLAB’s Symbolic MathToolbox, you can carry out algebraic
or symbolic calculations such as factoring polynomials or solving algebraic
equations. Type help symbolic to make sure that the Symbolic Math Tool-
box is installed on your system.
To perform symbolic computations, you must use syms to declare the vari-
ables you plan to use to be symbolic variables.
Consider the following series of commands:
>> syms x y
>> (x - y)*(x - y)ˆ2
ans =
>> expand(ans)
ans =
>> factor(ans)
ans =

Notice that symbolic output is left-justified, while numeric output is
indented. This feature is often useful in distinguishing symbolic output
from numerical output.

Although MATLAB makes minor simplifications to the expressions you
type, it does not make major changes unless you tell it to. The command ex-
pand told MATLAB to multiply out the expression, and factor forced MAT-
LAB to restore it to factored form.
MATLAB has a command called simplify, which you can sometimes use
to express a formula as simply as possible. For example,

>> simplify((xˆ3 - yˆ3)/(x - y))
ans =
MATLAB has a more robust command, called simple, that sometimes does
a better job than simplify. Try both commands on the trigonometric
expression sin(x)*cos(y) + cos(x)*sin(y) to compare — you’ll have
to read the online help for simple to completely understand the answer.


Related Posts Plugin for WordPress, Blogger...

civil engineering,electrical and other engg. software video tutorials.ebook and setups for free.... SAP2000,ETABS,SAFE,Autocad,revit Architecture,MS Project,Primavera ,Matlab,PSpice and much more

  © Blogger templates Newspaper III by 2008

Back to TOP