东北大学matlab上机作业1.docx
- 文档编号:9203371
- 上传时间:2023-02-03
- 格式:DOCX
- 页数:30
- 大小:425.06KB
东北大学matlab上机作业1.docx
《东北大学matlab上机作业1.docx》由会员分享,可在线阅读,更多相关《东北大学matlab上机作业1.docx(30页珍藏版)》请在冰豆网上搜索。
东北大学matlab上机作业1
《MATLAB语言与应用》上机实验作业
第一部分
1、
在matlab窗口下点击’help’弹出如下窗口,窗口左侧的列表框可以选择各种不同组合的演示内容。
2、
>>A=[1,2,3,4;4,3,2,1;2,3,4,1;3,2,4,1]
A=
1234
4321
2341
3241
>>B=[1+4j,2+3j,3+2j,4+1j;4+1j,3+2j,2+3j,1+4j;2+3j,3+2j,4+1j,1+4j;3+2j,2+3j,4+1j,1+4j]
B=
1.0000+4.0000i2.0000+3.0000i3.0000+2.0000i4.0000+1.0000i
4.0000+1.0000i3.0000+2.0000i2.0000+3.0000i1.0000+4.0000i
2.0000+3.0000i3.0000+2.0000i4.0000+1.0000i1.0000+4.0000i
3.0000+2.0000i2.0000+3.0000i4.0000+1.0000i1.0000+4.0000i
>>A(5,6)=5
A=
123400
432100
234100
324100
000005
3、
>>A=magic(8)
A=
642361606757
955541213515016
1747462021434224
4026273736303133
3234352928383925
4123224445191848
4915145253111056
858595462631
>>B=A(2:
2:
end,:
)
B=
955541213515016
4026273736303133
4123224445191848
858595462631
4、
>>sum(sym
(2).^[0:
63])
ans=
184********709551615
5、
t=[-1:
0.03:
-0.25,-0.249:
0.007:
0.249,0.25:
0.4:
1];y=sin(1./t);plot(t,y)
t=[-pi:
0.05:
-1.8,-1.799:
0.001:
-1.2,-1.2:
0.005:
1.2,1.201:
0.001:
1.8,1.81:
0.05:
pi];y=sin(tan(t))-tan(sin(t));plot(t,y)
6、
三维图xx=[-2:
.1:
-1.2,-1.1:
0.02:
-0.9,-0.8:
0.1:
0.8,0.9:
0.02:
1.1,1.2:
0.1:
2];yy=[-1:
0.1:
-0.2,-0.1:
0.02:
0.1,0.2:
.1:
1];[x,y]=meshgrid(xx,yy);
z=1./(sqrt((1-x).^2+y.^2))+1./(sqrt((1+x).^2+y.^2));surf(x,y,z),shadingflat;zlim([0,15])
三视图
[x,y]=meshgrid(-2:
.1:
2);z=1./(sqrt((1-x).^2+y.^2))+1./(sqrt((1+x).^2+y.^2));
subplot(221),surf(x,y,z),view(0,90);subplot(222),surf(x,y,z),view(90,0);subplot(223),surf(x,y,z),view(0,0);
7、
(1)symsx;f=(3^x+9^x)^(1/x);L=limit(f,x,inf)
L=
9
(2)symsxy;f=(x*y)/(sqrt(x*y+1)-1);L=limit(limit(f,x,0),y,0)
L=
2
(3)Symsxy;f=(1-cos(x^2+y^2))/((x^2+y^2)*exp(x^2+y^2));L=limit(limit(f,x,0),y,0)
L=
0
8、
(1)symst;x=log(cos(t));y=cos(t)-t*sin(t);f1=diff(y,t)/diff(x,t)
f1=
-(-2*sin(t)-t*cos(t))/sin(t)*cos(t)
(2)
symst;x=log(cos(t));y=cos(t)-t*sin(t);f2=diff(y,t,2)/diff(x,t,2);subs(f2,t,sym(pi)/3)
ans=
3/8-1/24*pi*3^(1/2)
9、
symsxyt;f=int(exp(-t^2),t,0,x*y);I=simple(x/y*diff(f,x,2)-2*diff(diff(f,x),y)+diff(f,y,2))
I=
-2*exp(-x^2*y^2)*(-x^2*y^2+1+x^3*y)
10、
(1)symsmn;limit(symsum(1/((2*m)^2-1),m,1,n),n,inf)
ans=
1/2
(2)symsmn;limit(symsum(n*(1/(n^2+m*pi)),m,1,n),n,inf)
ans=
1
11、
(1)symsat;symsapositive;x=a*(cos(t)+t*sin(t));y=a*(sin(t)-t*cos(t));I=simple(int((x^2+y^2)*sqrt(diff(x,t)^2+diff(y,t)^2),t,0,2*pi))
I=
(2*pi^2+4*pi^4)*a^3
(2)symsxyabct;x=c*cos(t)/a;y=c*sin(t)/b;P=y*x^3+exp(y);Q=x*y^3+x*exp(y)-2*y;ds=[diff(x,t);diff(y,t)];I=int([P,Q]*ds,t,0,pi)
I=
-2/15*c*(-2*c^4+15*b^4)/b^4/a
12、
functionA=vander(v)
n=length(v);v=v(:
);A=sym(ones(n));
forj=n-1:
-1:
1,A(:
j)=v.*A(:
j+1);end
symsabcde;
>>A=vander([abcde]);B=simple(det(A))
B=
(c-d)*(b-d)*(b-c)*(a-d)*(a-c)*(a-b)*(-d+e)*(e-c)*(e-b)*(e-a)
13.
A=[-2,0.5,-0.5,0.5;0,-1.5,0.5,-0.5;2,0.5,-4.5,0.5;2,1,-2,-2];[V,J]=jordan(sym(A))
V=
[0,1/2,1/2,-1/4]
[0,0,1/2,1]
[1/4,1/2,1/2,-1/4]
[1/4,1/2,1,-1/4]
J=
[-4,0,0,0]
[0,-2,1,0]
[0,0,-2,1]
[0,0,0,-2]
14、
数值解
A=[3,-6,-4,0,5;1,4,2,-2,4;-6,3,-6,7,3;-13,10,0,-11,0;0,4,0,3,4];B=[3,-2,1;-2,-9,2;-2,-1,9];C=[-2,1,-1;4,1,2;5,-6,1;6,-4,-4;-6,6,-3];X=lyap(A,B,C),norm(A*X+X*B+C)
X=
-4.0569-14.51281.5653
0.035625.0743-2.7408
9.488625.9323-4.4177
2.696921.6450-2.8851
7.722931.9100-3.7634
ans=
2.7917e-013
解析解
functionX=lyap(A,B,C)
ifnargin==2,C=B;B=A';end
[nr,nc]=size(C);A0=kron(A,eye(nc))+kron(eye(nr),B');
try
C1=C';x0=-inv(A0)*C1(:
);X=reshape(x0,nc,nr)';
catch,error('singularmatrixfound.'),end
A=[3,-6,-4,0,5;1,4,2,-2,4;-6,3,-6,7,3;-13,10,0,-11,0;0,4,0,3,4];
B=[3,-2,1;-2,-9,2;-2,-1,9];
C=-[-2,1,-1;4,1,2;5,-6,1;6,-4,-4;-6,6,-3];
X=lyap(sym(A),B,C),norm(double(A*X+X*B+C))
X=
[434641749950/107136516451,4664546747350/321409549353,-503105815912/321409549353]
[-3809507498/107136516451,-8059112319373/321409549353,880921527508/321409549353]
[-1016580400173/107136516451,-8334897743767/321409549353,1419901706449/321409549353]
[-288938859984/107136516451,-6956912657222/321409549353,927293592476/321409549353]
[-827401644798/107136516451,-10256166034813/321409549353,1209595497577/321409549353]
ans=
0
15、
functionF=funm(A,fun,x)
[V,J]=jordan(A);v1=[0,diag(J,1)'];v2=[find(v1==0),length(v1)+1];
fori=1:
length(v2)-1
v_lambda(i)=J(v2(i),v2(i));v_n(i)=v2(i+1)-v2(i);
end
m=length(v_lambda);F=sym([]);
fori=1:
m
J1=J(v2(i):
v2(i)+v_n(i)-1,v2(i):
v2(i)+v_n(i)-1);
fJ=funJ(J1,fun,x);F=diagm(F,fJ);
end
F=V*F*inv(V);
functionfJ=funJ(J,fun,x)
lam=J(1,1);f1=fun;fJ=subs(fun,x,lam)*eye(size(J));
H=diag(diag(J,1),1);H1=H;
fori=2:
length(J)
f1=diff(f1,x);a1=subs(f1,x,lam);fJ=fJ+a1*H1;H1=H1*H/i;
end
functionA=diagm(A1,A2)
A=A1;[n,m]=size(A);[n1,m1]=size(A2);A(n+1:
n+n1,m+1:
m+m1)=A2;
symsxt;A=[-4.5,0,0.5,-1.5;-0.5,-4,0.5,-0.5;1.5,1,-2.5,1.5;0,-1,-1,-3];A=sym(A);B=expm(A*t),
C=funm(A,sin(x*t),x),D=funm(A,exp(x*t)*sin(x^2*exp(x*t)*t),x)
B=
[1/2*exp(-3*t)-1/2*t*exp(-3*t)+1/2*exp(-5*t)+1/2*t^2*exp(-3*t),1/2*exp(-5*t)-1/2*exp(-3*t)+t*exp(-3*t),1/2*t*exp(-3*t)+1/2*t^2*exp(-3*t),1/2*exp(-5*t)-1/2*exp(-3*t)-1/2*t*exp(-3*t)+1/2*t^2*exp(-3*t)]
[1/2*t*exp(-3*t)+1/2*exp(-5*t)-1/2*exp(-3*t),1/2*exp(-3*t)+1/2*exp(-5*t),1/2*t*exp(-3*t),1/2*t*exp(-3*t)+1/2*exp(-5*t)-1/2*exp(-3*t)]
[1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t),-1/2*exp(-5*t)+1/2*exp(-3*t),exp(-3*t)+1/2*t*exp(-3*t),1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t)]
[-1/2*t^2*exp(-3*t),-t*exp(-3*t),-1/2*t^2*exp(-3*t)-t*exp(-3*t),exp(-3*t)-1/2*t^2*exp(-3*t)]
C=
[-1/2*sin(5*t)+1/2*sin(3*t)*t^2-1/2*cos(3*t)*t-1/2*sin(3*t),-1/2*sin(5*t)+cos(3*t)*t+1/2*sin(3*t),1/2*cos(3*t)*t+1/2*sin(3*t)*t^2,-1/2*sin(5*t)+1/2*sin(3*t)+1/2*sin(3*t)*t^2-1/2*cos(3*t)*t]
[-1/2*sin(5*t)+1/2*cos(3*t)*t+1/2*sin(3*t),-1/2*sin(5*t)-1/2*sin(3*t),1/2*cos(3*t)*t,-1/2*sin(5*t)+1/2*cos(3*t)*t+1/2*sin(3*t)]
[1/2*sin(5*t)+1/2*cos(3*t)*t-1/2*sin(3*t),1/2*sin(5*t)-1/2*sin(3*t),-sin(3*t)+1/2*cos(3*t)*t,1/2*sin(5*t)+1/2*cos(3*t)*t-1/2*sin(3*t)]
[-1/2*sin(3*t)*t^2,-cos(3*t)*t,-cos(3*t)*t-1/2*sin(3*t)*t^2,-sin(3*t)-1/2*sin(3*t)*t^2]
D=
[1/2*exp(-5*t)*sin(25*exp(-5*t)*t)+1/2*t^2*exp(-3*t)*sin(9*t*exp(-3*t))+t*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))-1/2*exp(-3*t)*sin(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))^2+1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(2*t*exp(-3*t)-12*t^2*exp(-3*t)+9*t^3*exp(-3*t))-1/2*t*exp(-3*t)*sin(9*t*exp(-3*t))-1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))+1/2*exp(-3*t)*sin(9*t*exp(-3*t)),1/2*exp(-5*t)*sin(25*exp(-5*t)*t)+t*exp(-3*t)*sin(9*t*exp(-3*t))+exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))-1/2*exp(-3*t)*sin(9*t*exp(-3*t)),1/2*t*exp(-3*t)*sin(9*t*exp(-3*t))+1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))+1/2*t^2*exp(-3*t)*sin(9*t*exp(-3*t))+t*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))-1/2*exp(-3*t)*sin(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))^2+1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(2*t*exp(-3*t)-12*t^2*exp(-3*t)+9*t^3*exp(-3*t)),1/2*exp(-5*t)*sin(25*exp(-5*t)*t)-1/2*exp(-3*t)*sin(9*t*exp(-3*t))+1/2*t^2*exp(-3*t)*sin(9*t*exp(-3*t))+t*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))-1/2*exp(-3*t)*sin(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))^2+1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(2*t*exp(-3*t)-12*t^2*exp(-3*t)+9*t^3*exp(-3*t))-1/2*t*exp(-3*t)*sin(9*t*exp(-3*t))-1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))]
[1/2*exp(-5*t)*sin(25*exp(-5*t)*t)+1/2*t*exp(-3*t)*sin(9*t*exp(-3*t))+1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))-1/2*exp(-3*t)*sin(9*t*exp(-3*t)),1/2*exp(-5*t)*sin(25*exp(-5*t)*t)+1/2*exp(-3*t)*sin(9*t*exp(-3*t)),1/2*t*exp(-3*t)*sin(9*t*exp(-3*t))+1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t)),1/2*exp(-5*t)*sin(25*exp(-5*t)*t)+1/2*t*exp(-3*t)*sin(9*t*exp(-3*t))+1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))-1/2*exp(-3*t)*sin(9*t*exp(-3*t))]
[-1/2*exp(-5*t)*sin(25*exp(-5*t)*t)+1/2*t*exp(-3*t)*sin(9*t*exp(-3*t))+1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))+1/2*exp(-3*t)*sin(9*t*exp(-3*t)),-1/2*exp(-5*t)*sin(25*exp(-5*t)*t)+1/2*exp(-3*t)*sin(9*t*exp(-3*t)),exp(-3*t)*sin(9*t*exp(-3*t))+1/2*t*exp(-3*t)*sin(9*t*exp(-3*t))+1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t)),-1/2*exp(-5*t)*sin(25*exp(-5*t)*t)+1/2*t*exp(-3*t)*sin(9*t*exp(-3*t))+1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))+1/2*exp(-3*t)*sin(9*t*exp(-3*t))]
[-1/2*t^2*exp(-3*t)*sin(9*t*exp(-3*t))-t*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))+1/2*exp(-3*t)*sin(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))^2-1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(2*t*exp(-3*t)-12*t^2*exp(-3*t)+9*t^3*exp(-3*t)),-t*exp(-3*t)*sin(9*t*exp(-3*t))-exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t)),-t*exp(-3*t)*sin(9*t*exp(-3*t))-exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))-1/2*t^2*exp(-3*t)*sin(9*t*exp(-3*t))-t*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))+1/2*exp(-3*t)*sin(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))^2-1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(2*t*exp(-3*t)-12*t^2*exp(-3*t)+9*t^3*exp(-3*t)),exp(-3*t)*sin(9*t*exp(-3*t))-1/2*t^2*exp(-3*t)*sin(9*t*exp(-3*t))-t*exp(-3*t)*cos(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))+1/2*exp(-3*t)*sin(9*t*exp(-3*t))*(-6*t*exp(-3*t)+9*t^2*exp(-3*t))^2-1/2*exp(-3*t)*cos(9*t*exp(-3*t))*(2*t*exp(-3*t)-12*t^2*exp(-3*t)+9*t^3*exp(-3*t))]
第二部分
1、
(1)symstalpha;f=sin(alpha*t)/t;F=laplace(f)
F=
atan(alpha/s)
(2)symstalpha;f=t^5*sin(alpha*t);F=la
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 东北大学 matlab 上机 作业