matlab期末考试

matlab期末考试

ID:83407711

大小:1.60 MB

页数:16页

时间:2023-04-22

上传者:灯火阑珊2019
matlab期末考试_第1页
matlab期末考试_第2页
matlab期末考试_第3页
matlab期末考试_第4页
matlab期末考试_第5页
matlab期末考试_第6页
matlab期末考试_第7页
matlab期末考试_第8页
matlab期末考试_第9页
matlab期末考试_第10页
资源描述:

《matlab期末考试》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

MATLABᵨ(᱐)ὃᫀ%MATLABẠ%⚪%(1)zl=2*sin(85*pi/180)/(1+exp(2))%(2)x=[2,l+2i;-0.45,5];z2=0.5*log(x+sqrt(1+x.A2))%(3)a=-3.0:0.1:3.0;z3=(exp(0.3*a)-exp(-0.3*a))/2.*sin(a+0.3)+log((0.3+a)/2)%(4)t=0:0.5:2.5;z4=t."2.*(t>=0&t=l&t<2)+(t.A2-2*t+l).*(t>=2&t<3)%⚪A=[1234-4;34787;3657];B=[l3-1;203;3-27];A+6*BA-B+eye(size(A))A*BA.*BA3A.3A/BB\A[A,B][A([1,3],:)B2]%⚪A=[l2345;678910;1112131415;1617181920;2122232425]B=[3016;17-69;023-4;970;41311]C=A*BF=size(C)D=C(F(1)-2:F(1)F(2)-1:F(2))Awhos

1%⚪%(1):A=100:999;B=rem(A,21);C=length(find(B==0))%(2):A='IsdhKSDLKklsdkl,;k=find(A>='A'&A<='Z');A(k)=[]%MATLAB▣ᑖ᪆ᜐᳮ%⚪E=eye(3);R=rand(3,2);O=zeros(2,3);S=diag([2,2])A=[E,R;O,S];ex21=AA2ex21=[E,(R+R*S);0,SA2]%⚪H=hilb(5)P=pascal(5)ex22=det(H)ex22=det(P)ex22=cond(H)ex22=cond(P)%⚪A=fix(10*rand(5))ex23=det(A)ex23=trace(A)ex23=rank(A)ex23=norm(A)%⚪A=[-29,618;20,5,12;-8,8,5]Z[V,D]=eig(A)ex24=Vex24=D%ᦪᶍ

2%⚪%(1):A=[l/2,1/3,1/4;1/3,1/4,1/5;1/4,1/5,1/6];b=[0.95,0.67,0.52]ex25=inv(A)*b%(2):B=[0.95,0.67,0.53]1;ex25=inv(A)*B%(3):ex25=cond(A)%⚪A=hilb(4)A(:l)=[]zA(4,:)=[]B=[0.95,0.67,0.52]X=inv(A)*BBl=[0.95,0.67,0.53]Xl=inv(A)*B1N=cond(B)Nl=cond(Bl)Na=cond(A)%▣A᝱▣%⚪A=[l,2,3;4,5,6;7,8,9]ex26=sqrtm(A)ex26=sqrt(A)%sqrtmᦪ!▣ᓫ#$%&'(sqrtᦪ!▣)Ḅᐗ,$%&'%⌱./01᪀3&%⚪/0x=[-5.0,-3.0,l.0,20,25,30,5.0];y=[];%4567ᡠᨵy:Ḅ▣forx0=xifx0<0&x0~=-3y=[yx0*x0+x0-6];zelseifx0>=0&x0<5&x0~=2&x0J=3y=[yx0*x0-5*x0+6];zelse

3y=[yxO*xO-xO-l];zendendx%;<ᡠᨵxV3;<ᡠᨵyex31=xex31=y%⚪/0x=[-5,-3,l,2,25,3,5];y=[]fora=l:7ifx(a)<0&x(a)~=-3y=[y,(x(a))A2+x(a)-6];elseifx(a)>=0&x(a)<5&x(a)~=2&x(a)~=3y=[y,(x(a))A2-5*x(a)+6];elsey=[y,x(a)*x(a)-x(a)-1];endend%⚪/0x=input(1=;ᐭ?@ᑖᑴᡂCDifx>100|x<0dispLD;ᐭḄᡂCE@ᑖᑴᡂC(=FG;ᐭ஺,)elseifx<=100&x>=90disp(1A1);elseifx<=89&x>=80disp(1B1);elseifx<=79&x>=70disp(*C1);elseifx<=69&x>60disp(1D1);elsedisp(1E1);endendᵨ⚪/0

4s=input஺=;ᐭ?ᡂC(0ᑖᑮ100ᑖNO),)PsᵨQ67ᡂCwhile1%ᑨS;ᐭᡂCḄᔠᳮឋifs<0|s>100disp஺;ᐭḄᡂC◤ᙠ0ᑮ100NO(=FG;ᐭDs=input(1=;ᐭ?ᡂC(0ᑖᑮ100ᑖNO)1);elsebreak;endendswitchfix(s/10)3ZᡂC[<\]ᑨScase{9,10}disp(*A*)case8disp(1B1)case7disp(*C*)case6disp(1D1)otherwisedisp(1E1)end%⚪n=input(1=;ᐭᕒ__`1);h=input(1aᕒ__bcᦪD;ifh>120x=(h-120)*84*(1+0.15)+120*84;elseifh<60x=h*84-700;elsex=h*84;enddisp([num2str(n)J`ᕒ_I1Ḅde_f1,num2str(x)]);%⚪(gh!ᵨswitchijk)a=fix(10+(99-10)*rand(l2))%lmn?op᦮z

5ᦪx=a(1);y=a(2);t=input(,=;ᐭ|'}`(Js');ift=='+'z=x+y;elseift==*-*z=x-y;elseift==1*1z=x*y;elseift==1/1z=x/y;enddisp([num2str(x),t,num2str(y),lnum2str(z)])%;<|'1%⚪a=rand(5,6)%lm5x6Ḅop▣n=input((=;ᐭD⌕;<▣Ḅ%D;ifn>5disp஺<▣Ḅ%ᦪ(▣Ḅᨬ%()a(5,:)elsedisp([1▣ḄInum2str(n)J%1])a(n,:)end%1᪀/03&%⚪/0s=0;n=input(1n=?1);fori=l:ns=s+l/i/i;endPI=sqrt(6*s)Pi%⚪/0

6n=input(*n=?1);a=l:n;b=l./a.2;PI=sqrt(6*sum(b))Pi%⚪y=on=l;while(y<3)y=y+l/(2*n-l);n=n+l;endy=y-l/(2*(n-1)-1)n=n-2%⚪a=input(1a=?1);b=input('b=?1);Xn=l;Xnl=a/(b+Xn);n=0;whileabs(Xnl-Xn)>le-5Xn=Xnl;Xnl=a/(b+Xn);n=n+l;ifn==500break;endendnXnlrl=(-b+sqrt(b*b+4*a))/2r2=(-b-sqrt(b*b+4*a))/2%⚪fori=l:100ifi==lf(i)=lelseifi==2f(i)=0;elseifi==3f(i)=lelse

7f(i)=f(i-2)+f(i-3);endendmax(f)min(f)sum(f)length(find(f>0))length(find(f==0))length(find(f<0))%⚪s=0;n=0;fori=2:49b=i*(i+1)-1;m=fix(sqrt(b));forj=2:mifrem(b,j)==0breakendendifj==mn=n+l;s=s+b;endendns%ᦪᦻ£%⚪functiony=matl(x)%45ᦪᦻ£matl.my=[exp(x)log(x),sin(x),cos(x)];r%ᙠ¤¥¦§¨ᵨ©ªᦪᦻ£y=matl(1+i)%⚪/0function[a,b,N,M]=shiyanwu2(m,n,t)A=[m*cos(t*pi/180)-sin(t*pi/180)0;m*sin(t*pi/180),0,rfcos(t*pi/180),0;0,n,-sin(t*pi/180),0;0,0,-cos(t*pi/180)1z]B=[0,9.8*m,0,9.8*n];

8C=inv(A)*B';a=C(l);b=C(2);N=C(3);M=C(4);%ᙠ¤¥¦§¨ᵨaᦪᦻ£ml=input(Iml=1);m2=input('m2=1);theta=input(1theta=1);[al,a2,Nl,N2]=shiyanwu2(ml,m2,theta)%⚪/0functionX=mat2(ml,m2,t)g=9.8;A=[ml*cos(t*pi/180),-ml,-sin(t*pi/180)0;ml*sin(t*pi/180)r0,cos(t*pi/180)0;0,m2-sin(t*pi/180)0;0,0,-cos(t*pi/18rzzz0),1]B=[0;ml*g;0;m2*g];X=inv(A)*B;%ᙠ¤¥¦§¨ᵨaᦪᦻ£X=mat2(1,1,60)%⚪functionflag=mat3(x)flag=l;fori=2:sqrt(x)ifrem(x,i)==0flag=0;break;endend%ᙠ¤¥¦§¨ᵨaᦪᦻ£fori=10:99j=10*rem(i10)+fix(i/10);rifmat3(i)&mat3(j)disp(i)endend%⚪functiony=fx(x)

9y=l./((x-2)«2+0.1)+1./((x-3)«4+0.01);%ᙠ¤¥¦§¨ᵨaᦪᦻ£y=fx(2)a=[l,2;3,4];y=fx(a)%⚪%(1)functionfl=mat5(n)fl=n+10*log(n*n+5);%ᙠ¤¥¦§)¨ᵨaᦪᦻ£y=mat5(40)/(mat5(30)+mat5(20))%(2)functionf2=mat6(n)f2=0;fori=l:nf2=f2+i*(i+1);end%ᙠ¤¥¦§)¨ᵨaᦪᦻ£᝞y=mat6(40)/(mat6(30)+mat6(20))%(2)functionf2=mat7(n)i=l:n;m=i.*(i+1);f2=sum(m);end%ᙠ¤¥¦§)¨ᵨaᦪᦻ£᝞y=mat7(40)/(mat7(30)+mat7(20))%®¯°±b%⚪x=linspace(02*pi,101);zy=(0.5+3*sin(x)./(1+x•³2)).*cos(x);plot(x,y)%⚪%(1)

10x=linspace(-2*pi,2*pi,100);yl=x.³2;y2=cos(2*x);y3=yl.*y2;Plot(x,ylJb-lx,y2,Ix,y3Jy—1);text(4,16,1\leftarrowyl=x^2T);text(6*pi/4-1,*\downarrowy2=cos(2*x),);ztext(-l5*pi,-225*pi*pi,1\uparrowy3=yl*y2*);%(2)x=linspace(-2*pi,2*pi,100);yl=x.³2;y2=cos(2*x);y3=yl.*y2;subplot(1,3,1);%ᑖµplot(x,yl);title(Tyl=xA2,);%3¶᪗⚪subplot(1,3,2);plot(x,y2);title(1y2=cos(2*x)1);subplot(1,3,3);plot(x,y3);title(*y3=xA2*cos(2*x),);%(3)x=linspace(-2*pi,2*pi,20);yl=x.A2;subplot(2,2,1);%ᑖµbar(x,yl);title('yl=xA2Ḅᩩ¹°,);%3¶᪗⚪subplot(2,2,2);stairs(x,yl);title('yl=xA2Ḅ▤»°();subplot(2,2,3);stem(x,yl);title(fyl=xA2Ḅᩚ°!);subplot(2,2,4);fill(x,yl,'r');%᝞¾(r(ᑣÀ<┯

11title(1yl=xA2ḄÂᐙ°T);%ᐸÆḄᦪ᯿᪵[஺%⚪x=-5:0.01:5;É=§PÊË3ÉÌᔣÎforx0=xifx0<=0%EÏᑏᡂx0=<0y=[y,(xO+sqrt(pi))/exp(2)];%ÑxZdḄᦪ:7ᑮy)elsey=[y0.5*log(xO+sqrt(1+xO³2))];zendendplot(x,y)%⚪a=input(1a=1);b=input(*b=1);n=input(Tn=1);t=-2*pi:0.01:2*pi;r=a*sin(b+n*t);polar(t,r)%⚪x=linspace(-5,5,21);y=linspace(0,10,31);[x,y]=meshgrid(x,y);%ᙠ[-5,5]*[0,10]ḄÓᑁmᡂÕÖᙶ᪗z=cos(x).*cos(y)*exp(-sqrt(x•³2+y•³2)/4);subplot(2,1,1);surf(x,y,z);subplot(2,1,2);contour3(x,y,z,50);%ᐸ)50ØḄ\]ᦪ(ÙᜧÙÛ%⚪ezsurf(Tcos(s)*cos(t)1,Tcos(s)*sin(t)1,1sin(s)I[0,0.5*pi0,1.5*pi]);%ᑭᵨezsurf◚ᦪz

12shadinginterp%$%Þ:Ḽ⁐ᜐᳮ%ṇâ㮯°±b%⚪h=figure(*MenuBar*1figure11color1*WindowButtonDownrrrFenI1disp(1TLeftButtonPressed11)1)%⚪x=-2:0.01:2;y=x•³2•ᦻ೐xp(2*x);h=line(x,y);set(h,1color1,'r1linestyle11:1linewidth2)rtext(1exp(2)1y=xA2*exp(2*x)1)rr%⚪t=0:0.00001:0.001;[t,x]=meshgrid(t);v=10*exp(-0.01*x).*sin(2000*pi*t-0.2*x+pi)axes(fview*[-37.5,30]);rh=surface(t,x,v);title(*v=10*exp(-0.01*x).*sin(2000*pi*t-0.2*x+pi)*);xlabel(Ct1),ylabel(X),zlabel(TvT)%⚪x=0:0.01:2*pi;yl=sin(x);y2=cos(x);y3=tan(x);y4=cot(x);subplot(2,2,1);plot(x,yl);subplot(2,2,2);plot(x,y2);subplot(2,2,3);plot(x,y3);subplot(2,2,4);plot(x,y4);%⚪cylinder(5);light(1Position1[0,1,1]);rmaterialshiny

13%äᦪåᜐᳮæ⚗è|'%⚪%(1)A=rand(1,30000);b=mean(A)std(A,0,2)%(2)max(A)min(A)%(3)n=0;fori=l:30000ifA(i)>0.5n=n+l;endendp=n/30000%⚪%(1)A=45+51*rand(100,5);[Y,U]=max(A)[ab]=min(A)A%(2)m=mean(A)s=std(A)%(3)sum(A,2)[Y,U]=max(ans)[a,b]=min(ans)%(4)[zcj,xsxh]=sort(ans)%⚪h=6:2:18;x=6.5:2:17.5;tl=[18,20,22,25,30,28,24];t2=[1519,24,28,34,32,30];zTl=spline(h,tlx)zT2=spline(h,t2,x)%⚪

14x=l:0.1:101;yl=logl0(x);p=polyfit(x,yl,5)y2=polyval(p,x);plot(xyl,1:Ix,y2,Dr%⚪%(1)pl=[l,2,4,0,5];p2=[l,2];p3=[l,2,3];p=pl+[0,conv(p2,p3)]%énᔣÎᜧêëì(ᡠ!⊡0%(2)A=roots(p)%(3)A=[-1,1.2,-1.4;0.75,2,3.5;0,5,2.5];polyval(p,A)%(4)polyvalm(p,A)îïex91g=inlineCdet([xx.-2x.-3;12.*x3.*x."2;026.*x])');y=l:0.01:3.01;yl<];fort=yyl=[yl,g(t)];endy2=diff(yl)/0.01;ex911=y2(l)ex912=y2(101)ex913=y2(201)ex921a=inline('sqrt(cos(t.2)+4*sin((2*t).-2)+l)));>>ex921=quadl(a,0,2*pi)ex93A=[6,5,-2,5;9,-1,4,-1;3,4,2,-2;3,-9,0,2];»b=E-4,13,1,11?;»ex93=A\b

15ex95functionf=fz(x)f=3*x+sin(x)-exp(x);fzero(z',-15)ex97functiondy=vdp5(x,y)dy=zeros(2,1)dy(l)=yফdy(2)=5*y(2)/x-y(l)/xex97=[x,y]=ode45('g',[xO,xf],[0,0])

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
最近更新
更多
大家都在看
近期热门
关闭