正在加载图片...
ATLAB Lecture 5 School of Mathematical Sciences Xiamen University http∥gdjpkc.xmu.edu.cr > A(2, 3)=beta; % replace the(2, 3)entry of A with beta >>A=subs(A, b, alpha) %replace the variable b with alpha A I alpha, From this example, you can see that using symbolic objects is very similar to using regular MATLAB numeric objec 令 Simplifications pretty >>syms x f=x^3-6*x^2+11*x-6 >> >>h=-6+(11+(-6+x)*x)*x > pretty(f), pretty(g), pretty(h) %generate their pretty printed forms 32 6x+11x-6 (x-1)(x-2)(X-3) -6+(11+(-6+x)x)x collecto) views f as a polynomial in its symbolic variable, say x, and collects all the coefficients with the same power of x. A second argument can specify the variable in which to collect terms if there is more than one candidate collect(f) x-1)*(x-2)*(x-3) x×36*×2+116 x°(x°(X-6)+116 x^3-6*x^2+11*x-6 (1+x)°t+x*t 2*x*t+t expand(d distributes products over sums and applies other identities invol ving functions of sums (x-1)*(x-2)*(x-3) x^3-6*x^2+11*x-6 x(x*(x-6)+11)-6 x^3-6*x^2+11*x-6 exp(a+b) p(a)°exp(b) cos(x+y) sIn(xsIl n(y) cos(3*acos(x)) 4*x^3-3*x transforms a symbolic polynomial f into its hornerMATLAB Lecture 5  School of Mathematical Sciences Xiamen University  http://gdjpkc.xmu.edu.cn  Lec5­5  >> A(2,3) = beta;  % replace the (2,3) entry of A with beta  >> A = subs(A,b,alpha) %replace the variable b with alpha A =  [ a, alpha,  c] [ alpha,  c,  beta] [ c,  a, alpha] From this example, you can see that using symbolic objects is very similar to using regular MATLAB numeric objects.  ² Simplifications  pretty >> clear >> syms x  >> f = x^3­6*x^2+11*x­6;  >> g = (x­1)*(x­2)*(x­3);  >> h = ­6+(11+(­6+x)*x)*x;  >> pretty(f), pretty(g), pretty(h) %generate their pretty printed forms  3  2  x ­ 6 x  + 11 x ­ 6  (x ­ 1) (x ­ 2) (x ­ 3) ­6 + (11 + (­6 + x) x) x collect collect(f) views  f as  a polynomial  in  its  symbolic variable,  say x,  and  collects all the coefficients with the same power of x. A second argument can specify the variable in which  to collect terms if there is more than one candidate.  f collect(f) (x­1)*(x­2)*(x­3) x^3­6*x^2+11*x­6  x*(x*(x­6)+11)­6  x^3­6*x^2+11*x­6  (1+x)*t + x*t  2*x*t+t expand expand(f) distributes products over sums and applies other identities involving functions of sums.  f expand(f) a*(x + y) a*x + a*y  (x­1)*(x­2)*(x­3) x^3­6*x^2+11*x­6  x*(x*(x­6)+11)­6  x^3­6*x^2+11*x­6  exp(a+b) exp(a)*exp(b) cos(x+y) cos(x)*cos(y)­sin(x)*sin(y) cos(3*acos(x)) 4*x^3­3*x horner horner(f) transforms a symbolic polynomial f into its Horner, or nested, representation
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有