《Matlab基础与应用教程答案(人民邮电出版社).docx》由会员分享,可在线阅读,更多相关《Matlab基础与应用教程答案(人民邮电出版社).docx(18页珍藏版)》请在优知文库上搜索。
1、第1章一、思索题4. (1)B=A(2:5,1:2:5)(2) A(7)=(3) A=A+30(4) size(八)(5) t(find(t=O)=eps(6) t=reshape(x,3,4)(7) abs(matlab,)(8) char(93)54z7;9,3,0;5. A=97,67,34,10;-78,75,65,5;32,5,-23,-59;0,-12,(1) B=A(I:3,:)C=A(:,1:2)D=A(2:4,3:4)E=B*C(2)A(find(A=50&A120gz=dj*120+1.15*dj*(h-120);elseifh60gz=dj*h-700;elsegz=dj
2、*h;endformatbank;display(ghzgz)3.循环结构n=input(,inputn:);s=0;fork=l:ns=s+lk2;enddisplay(sqrt(s*6)向量运算n=input(inputn:);k=l:n;display(sqrt(sum(1./k.2)*6)4.y=0;k=0;whiley=le-5&k500x=x;x=a(b+x);k=k+l;enddisplay(krx);display(-b+sqrt(b2+4*a)/2,(-b-sqrt(b2+4*a)2);6.y=fun(40)/(fun(30)+fun(20)(1)函数文件fun.mfunct
3、ionf=fun(n)f=n+log(n2+5);(2)函数文件fun.mfunctionf=fun(n)a=l:n;f=sum(a.*(a+l);第3章一、思索题4.t=0:0.01:1.5;y=sqrt(3)2*exp(-4*t).*sin(4*sqrt(3)*t+pi3);5.x=-10:0.01:10;y=linspace(-6,6,size(xz2)z=x.A3+3*x.*y.a2;plot3(x,y,z)6.x=100:100:400;y=100:100:400;z=636z697z624z478;698z712z630z478;680z674,598z412;662r626z55
4、2z334;X,Y=meshgrid(xry);mesh(X,Yzz)二、试验题1.(1) x=-10:0.01:10;plot(xx-x.a332)(2) plot(xzexp(-x.*x2)2pi)(3) x=-8:0.01:8;plot(x,sqrt(64-x.*x)/2)(4) t=0:pi/100:6*pi;plot(t.*sin(t)zt.*cos(t)2. (1)Xl=Iinspace(0,1z100);yl=2*xl-0.5;t=linsace(0ziz100);x=sin(3*t).*cos(t);y=sin(3*t).*sin(t);plot(xlzyl,r-zx,yzb:
5、,);text(0.4zl,y=2x-0.5,);text(-0.4,0.5,x=sin(3t)cos(t),);text(-0.40.3z,y=sin(3t)sin(t),);(2)subplot(1,2,1);scatter(xlryl,10)title(,y=2x-0.5,);subplot(1,2,2);scatter(x,y,10)3.subplot(l,2zl);x=l:1:100;y=sin(1.x);plot(x,y)subplot(1,2z2);fplot(,sin(lx),zlz100)4.subplot(2,2zl);bar(t,y);subplot(2z2z2);sta
6、irs(tzy);subplot(2,2,3);stem(t,y)subplot(2,2,4);Semilogy(t,y);5.theta=linspace(-pizpi,100);ro=5.*cos(theta)+4;polar(thetazro);fi=linspace(0r2*pi,100);a=lr=a.*(l+cos(fi);polar(fizr);6.t=0:pi/20:2*pi;x=exp(-t./20).*cos(t);y=exp(-t./20).*sin(t);z=t;Plot3(,yfz);t=0:0.01:1;x=t;y=t.a2;z=t.a3;plot3(x,yrz);7.x=-30:0.1:0;y=0:0.1:30;xzy=meshgrid(x,y);z=10.*sin(sqrt(x.2+y.a2).sqrt(l+x.A2+y.a2);meshe(,yfz);8.X=Iinspace(-3,3z100);y=linspace(-3z3z100);xy=meshgrid(x,y);fxy=-5./(1+x.A2+y.a2);i=find(abs(x)=0.8&abs(y)0.5)/size(八)2.h=466r715,950z1422z1635;w=7.04z4.28,3.40z2.52,2.13;hh=500z900z1500