chapter 11 calculus. symbolic expressions required: > symbolic math toolbox > use symbolic...
TRANSCRIPT
Chapter 11Calculus
Symbolic ExpressionsRequired:> Symbolic Math Toolbox> Use Symbolic Variables
Functions for Symbolic Processingx = sym(‘x’) Creates the symbolic variable with name x.
syms x y u v Creates the symbolic variables x, y, u, & v.
Simplify(ans) Simplifies the expression ans.
Symbolic Expression Example>>syms x y>>s=x+y;>>r=sqrt(x^2+y^2);
Symbolic Expression Example>>n=3;>>syms x;>>A=x.^((0:n)’*(0:n))>>A=
[1, 1, 1, 1][1, x, x^2, x^3][1, x^2, x^4, x^6][1, x^3, x^6, x^9]
Manipulating ExpressionsUse the expand command:>>syms x y>>expand((x+y)^2)ans=
x^2+2*x*y+y^2>>expand(sin(x+y))ans=
sin(x)*cos(y)+cos(x)*sin(y)
Evaluating ExpressionsUse subs(E, old, new) or double(y):>>syms x>>E=x^2+6*x+7;>>G=subs(E,x,2)G= 23
Multiple Variables>>syms x y z>>E=x^2+6*y+2*z;>>subs(E,{x,y,z},{2,2,3})ans =
22
Using Double Command Example>>sqroot2=sym(‘sqrt(2)’);>>y=6*sqroot2y=
6*2^(1/2)>>z=double(y)z=
8.4853
Plotting ExpressionsUse ezplot command:>>syms x>>E=x^2-6*x+7;>>ezplot(E,[-2 6])
Symbolic Calculus Functionsdiff(E) Returns the derivative of the expression E with respect to the default independent variable.diff(E,v) To variable v.diff(E,v,n) nth derivative int(E) Returns the integrallimit(E) Returns the limit
Laplace Transformslaplace(exp)
Returns Laplace transform.
ilaplace(exp) Returns inverse Laplace.