Transcript Unit7
Unit 7 Symbolic Processing
中華技術學院電子系 副教授 蔡樸生 副教授 林盈灝
Algebraic and Math. Operator
syms : Create Symbolic Variables expand : expands the expression by carrying out power simplify : simplifies the expression E factor : factors the expression E >> syms x y >> expand ((x+y)^3) >> expand (sin(x+y)) >> factor(x^2-1)
Algebraic and Math. Operator
>> E1=x^2+5; >> E2=y^3-2; >> S1=E1+E2 : S1=x^2+3+y^3 >> S2=E1*E2 : S2=(x^2+5)*(y^3-2) >> expand(S2) >> E3=x^3+2*x^2+5*x+10 >> S3=E3/E1 >> simplify(S3)
Evaluating Expressions
subs(E,old,new): To replace old with a numeric value to new in the expression E ezplot(E,[xmin xmax]) poly2sym([a,b,c…….],’v’) >> syms x >> E=x^2+6*x+7 >> G=subs(E,x,2) >> ezplot(E,[-2 6]) >> poly2sym([2,5,-3],’x’)
Test Your Understanding (I)
Given the expressions:
E
1
x
3 15
x
2 75
x
125
E
2 (
x
5) 2 20
x
Find the product E1*E2 and express it in its simplest form Find the quotient E1/E2 and express it in its simplest form Evaluate the sum E1+E2 at x=7.1
Differentiation
syms n x y diff(f(x,y),y,n) : 對於f(x,y)中的 y 作偏微 n 次 2
y
2
xy
)] [ sin(
xy
)]
y
[ln( )]
x
Integration
(
x n
)
x
int(f(x,y),y,a,b) : 對於f(x,y)由 a 到 b 作定積分 0 5 2
xy dy t
e t
sin
xdx
n x dn
a b
5
x dx
Test Your Understanding (II)
Given that , use MATLAB to find at x=0.2.
dx
Given that , use MATLAB to find
dz dy
Given that ,use MATLAB to
ydx
Use MATLAB to evaluate 5 2
x
find