扬州大学MATLAB实验7.1.3_第1页
扬州大学MATLAB实验7.1.3_第2页
扬州大学MATLAB实验7.1.3_第3页
扬州大学MATLAB实验7.1.3_第4页
扬州大学MATLAB实验7.1.3_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、1.实验目的(1) 学习MATLAB语言的基本符号运算;(2) 学习MATLAB语言的矩阵符号运算;(3) MAPLE函数调用。2.实验内容在下面的实验操作中,认真理解和查询每项操作的作用和目的。(1) 基本符号运算1) 符号微分,积分。 syms t f1=sin(2*t); df1=diff(f1) df1 = 2*cos(2*t) if1=int(f1) if1 = -1/2*cos(2*t)2)泰勒级数展开。 tf1=taylor(f1,8) tf1 = 2*t-4/3*t3+4/15*t5-8/315*t7 tf1=taylor(f1,8) tf1 = 2*t-4/3*t3+4/15

2、*t5-8/315*t7 3)符号代数方程求解。 syms a b c x f=a*x2+b*x+c; ef=sole(f) ef=solve(f) ef = 1/2/a*(-b+(b2-4*a*c)(1/2) 1/2/a*(-b-(b2-4*a*c)(1/2)4) 符号微分方程求解 f=D2x+2*Dx+10*x=0;g=Dx(0)=1,x(0)=0; dfg=dsolve(f,g) dfg = 1/3*exp(-t)*sin(3*t)5) 积分变换 syms t f1=exp(-2*t)*sin(5*t); F1=laplace(f1) F1 = 5/(s+2)2+25) syms s F

3、2=1/(s+2)2; f2=ilaplace(F2) f2 = t*exp(-2*t) syms t f1=sin(t); Fz1=ztrans(f1) Fz1 = z*sin(1)/(z2-2*z*cos(1)+1) syms z Fz2=z/(z-2)+z/(z-3); fz2=iztrans(Fz2) fz2 = 2n+3n6)计算精度。 g=sym(pi/2 2;3 exp(1) g = pi/2, 2 3, exp(1) g1=vpa(g) g1 = 1.5707963267948966192313216916398, 2. 3., 2.7182818284590452353602

4、874713527 digits Digits = 32 g1=vpa(g,5) g1 = 1.5708, 2. 3., 2.7183(2)符号矩阵运算1)创建与修改符号矩阵。 G1=sym(1/(s+1),s/(s+1)/(s+2);1/(s+1)/(s+2),s/(s+2) G1 = 1/(s+1), s/(s+1)/(s+2) 1/(s+1)/(s+2), s/(s+2) G2=subs(G1,G1(2,2),0) G2 = 1/(s+1), s/(s+1)/(s+2) 1/(s+1)/(s+2), 0 G3=G1(1,1) G3 = 1/(s+1)2) 符号线性代数inv 符号矩阵求逆

5、 det 符号矩阵行列式 eig 符号矩阵特征值 transpose 符号矩阵转置charpoly 符号特征多项式3) 常规符号运算。 syms s d1=1/(s+1);d2=1/(s+2);d=d1*d2 d = 1/(s+1)/(s+2) ad=sym(s+1 s;0 s+2);G=d*ad G = 1/(s+2), s/(s+1)/(s+2) 0, 1/(s+1) n1=1 2 3 4 5;n2=1 2 3; p1=poly2sym(n1);p2=poly2sym(n2); p=p1+p2 p = x4+2*x3+4*x2+6*x+8 pn=sym2poly(p)pn = 1 2 4

6、6 8 a=0 1;-2 -3; gcha=poly2sym(poly(eig(a) gcha = x2+3*x+2 sym s ans = s mg=s*eye(2)-a mg = s, -1 2, s+3 geig=transpose(eig(mg) geig = s+2, s+1 gdet=det(mg) gdet = s2+3*s+2 groot=transpose(solve(gdet) groot = -2, -1 G=inv(mg) G = (s+3)/(s2+3*s+2), 1/(s2+3*s+2) -2/(s2+3*s+2), s/(s2+3*s+2) g21=ilaplac

7、e(G(1,1); g22=ilaplace(G(2,2); g12=ilaplace(G(1,2); g21=ilaplace(G(2,1); g=g11 g12;g21 g22 g = -exp(-2*t)+2*exp(-t), exp(-t)-exp(-2*t) -2*exp(-t)+2*exp(-2*t), 2*exp(-2*t)-exp(-t)(3)MAPLE函数调用 maple 调用maple内核函数 mhelp maple库函数帮助命令 1)MAPLE下的泰勒级数展开。 maple(readlib(mtaylor);); tmap=maple(mtaylor(sin(2*t),t

8、)tmap =2*t-4/3*t3+4/15*t5 syms t;f=sin(2*t); tmat=taylor(f) tmat = 2*t-4/3*t3+4/15*t5 mhelp mtaylor mtaylor - multivariate Taylor series expansionCalling Sequence: mtaylor(f, v) mtaylor(f, v, n) mtaylor(f, v, n, w)Parameters: f - an algebraic expression v - a list or set of names or equations n - (o

9、ptional) non-negative integer w - (optional) list of positive integersDescription:- The mtaylor function computes a multivariate Taylor series expansion of the input expression f, with respect to the variables v, to order n, using the variable weights w. - The result type has changed in Maple V to b

10、e simply a polynomial in the variables with no order term. - The variables v can be a list or set of names or equations. If vi is an equation, then the left-hand side of vi is the variable, and the right-hand side is the point of expansion. If vi is a name, then vi = 0 is assumed as the point of exp

11、ansion. - If the third argument n is present then it specifies the truncation order of the series. The concept of truncation order used is total degree in the variables. If n is not present, the truncation order used is the value of the global variable Order, which is 6 by default. - If the fourth a

12、rgument w is present it specifies the variable weights to be used (by default all 1). A weight of 2 will halve the order in the corresponding variable to which the series is computed. - Note: mtaylor restricts its domain to pure Taylor series, those series with non-negative powers in the variables.

13、- This function must be loaded using readlib(mtaylor).Examples: readlib(mtaylor): mtaylor(sin(x2+y2), x,y); 2 2 x + y mtaylor(sin(x2+y2), x,y, 8); 2 2 6 2 4 4 2 6 x + y - 1/6 x - 1/2 y x - 1/2 y x - 1/6 y mtaylor(sin(x2+y2), x,y, 8, 2,1); 2 2 6 y + x - 1/6 y mtaylor(sin(x2+y2), x=1,y, 3); 2 2 sin(1)

14、 + 2 cos(1) (x - 1) + (-2 sin(1) + cos(1) (x - 1) + cos(1) y mtaylor(f(x,y), x,y, 3); 2f(0, 0) + D1(f)(0, 0) x + D2(f)(0, 0) y + 1/2 D1, 1(f)(0, 0) x 2 + x D1, 2(f)(0, 0) y + 1/2 D2, 2(f)(0, 0) ySee Also: taylor, series, coeftayl 2)MAPLE库函数与MATLAB函数。 FZ1=maple(ztrans(exp(-2*k),k,z);)FZ1 =z/exp(-2)/(

15、z/exp(-2)-1) syms k;f=exp(-2*k); FZ2=ztrans(f) FZ2 = z/exp(-2)/(z/exp(-2)-1) help ztrans - help for sym/ztrans.m - ZTRANS Z-transform. F = ZTRANS(f) is the Z-transform of the scalar sym f with default independent variable n. The default return is a function of z: f = f(n) = F = F(z). The Z-transform

16、 of f is defined as: F(z) = symsum(f(n)/zn, n, 0, inf), where n is fs symbolic variable as determined by FINDSYM. If f = f(z), then ZTRANS(f) returns a function of w: F = F(w). F = ZTRANS(f,w) makes F a function of the sym w instead of the default z: ZTRANS(f,w) F(w) = symsum(f(n)/wn, n, 0, inf). F

17、= ZTRANS(f,k,w) takes f to be a function of the sym variable k: ZTRANS(f,k,w) F(w) = symsum(f(k)/wk, k, 0, inf). Examples: syms k n w z ztrans(2n) returns z/(z-2) ztrans(sin(k*n),w) returns sin(k)*w/(1-2*w*cos(k)+w2) ztrans(cos(n*k),k,z) returns z*(-cos(n)+z)/(-2*z*cos(n)+z2+1) ztrans(cos(n*k),n,w)

18、returns w*(-cos(k)+w)/(-2*w*cos(k)+w2+1) ztrans(sym(f(n+1) returns z*ztrans(f(n),n,z)-f(0)*z See also IZTRANS, LAPLACE, FOURIER. mhelp ztrans ztrans - Z transformCalling Sequence: ztrans(f, n, z)Parameters: f - expression n - name z - name Description:- The function ztrans finds the Z transformation

19、 of f(n) with respect to z. Formally, ztrans(f(n),n,z) = sum(f(n)/zn,n=0.infinity). - ztrans recognizes and specially handles a large class of expressions, and only resorts to using the definition to calculate the transformation if the given expression has an unknown form. If the Z transform of the

20、given expression cannot be found in a closed form, then the left-hand side of the formal definition is returned, rather than the right-hand side. - ztrans recognizes the delta function as charfcn(.) and the step function as Heaviside(.). - This function has to be defined using readlib(ztrans) before

21、 it can be used. Examples: ztrans(f(n+1),n,z); z ztrans(f(n), n, z) - f(0) z ztrans(sin(Pi/2*t),t,z); z - 2 z + 1 ztrans(3n/n!,n,w); exp(3/w) ztrans(beta*5n*(n2+3*n+1),n,z); / z (1/5 z + 1) z z beta |1/5 - + 3/5 - + 1/5 -| | 3 2 1/5 z - 1| (1/5 z - 1) (1/5 z - 1) / ztrans(charfcn5(t)*Psi(t),t,w); 25

22、 - - gamma 12 - 5 w ztrans(n*Heaviside(n-3),n,z); 3 z - 2 - 2 2 z (z - 1) ztrans(invztrans(f(z),z,n),n,z); f(z)See Also: invztrans , inttranslaplace , rsolve 3)MAPLE库函数装入命令readlib。求符号函数F(s)=2/(s+3)2+4),s,t);) F=maple(invlaplace(2/(s+3)2+4),s,t);)F =-1/8*(-16)(1/2)*(exp(-3+1/2*(-16)(1/2)*t)-exp(-3-1/2*(-16)(1/2)*t)4)MAPLE工具包装入命令with。寻找二次多项式的完全平方。 maple(with(student);); a=maple(completesquare(x2+2*x+2)a =(x+1)2+15)MATLAB函数与NAPLE函数。 maple(mtaylo

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论