《Matlab基础及应用教程答案人民邮电出版社.docx》由会员分享,可在线阅读,更多相关《Matlab基础及应用教程答案人民邮电出版社.docx(16页珍藏版)》请在第一文库网上搜索。
1、第1章一、思考题4. (1)B=A(2:5,1:2:5)A(7)=(3) A=A+30(4)size(A)(5) t(find(t=O)=eps(6) t=reshape(xz3,4)(7) abs(,mat1ab,)(8) char(93)5. A=97,67,34,10;-78,75,65,5;32,5,-23,-59;0,-12,54,7(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);e1seifh60gz=dj*h-700;e1segz=dj*h;endforma
2、tbank;disp1ay(ghzgz)3.循环构造n=input(inputn:);s=0;fork=1:ns=s+1k2;enddisp1ay(sqrt(s*6)向量运算n=input(,inputn:);k=1:n;disp1ay(sqrt(sum(1./k.2)*6)4.y=O;k=O;whi1ey=1e-5&k500x=x;x=a(b+x);k=k+1;enddisp1ay(k,x);disp1ay(-b+sqrt(b2+4*a)2z(-b-sqrt(b2+4*a)/2);y=fun(40)/(fun(30)+fun(20)(1)函数文件fun.mfunctionf=fun(n)f=
3、n+1og(nA2+5);(2)函数文件fun.mfunctionf=fun(n)a=1:n;f=sum(a.*(a+1);第3章一、思考题t=0:0.01:1.5;y=sqrt(3)2*exp(-4*t).*sin(4*sqrt(3)*t+pi3);x=-10:0.01:10;y=1inspace(-6,6,size(xz2)z=x.3+3*x.*y.a2;p1ot3(x,y,z)x=100:100:400;y=100:100:400;z=636,697,624,478;698,712,630,478;680,674,598,412;662,626,552,334;X,Y=meshgrid(
4、x,y);mesh(X,Yzz)二、实验题(1) x=-10:0.01:10;p1ot(xzx-x.3/3/2)(2) p1ot(xzexp(-x.*x2)2pi)(3) x=-8:0.01:8;p1ot(xzsqrt(64-x.*x)/2)(4) t=0:pi/100:6*pi;p1ot(t.*sin(t),t.*cos(t)2. (1)X1=Iinspace(0,1z100);y1=2*x1-0.5;t=1inspace(0zpiz100);x=sin(3*t).*cos(t);y=sin(3*t).*sin(t);p1ot(x1zy1,r-,xzy,b:,);text(0.4z1,y=2
5、x-0.5,);text(-0.4z0.5zx=sin(3t)cos(t);text(-0.4z0.3zy=sin(3t)sin(t),);(2)subp1ot(1z2z1);scatter(x1,y1,10)tit1e(y=2x-0.5,);subp1ot(1z2z2);scatter(xryz10)subp1ot(1z2z1);=1:1:100;y=sin(1.x);p1ot(xzy)subp1ot(1,2,2);fp1ot(,sin(1x)f1z100)subp1ot(2,2,1);bar(tzy);subp1ot(2,2,2);stairs(t,y);subp1ot(2z2z3);st
6、em(t,y)subp1ot(2,2,4);semi1ogy(tzy);theta=1insace(-pizpiz100);ro=5.*cos(theta)+4;po1ar(theta,ro);fi=1inspace(0z2*i,100);a=1r=a.*(1+cos(fi);po1ar(fi,r);t=0:pi/20:2*pi;x=ex(-t./20).*cos(t);y=exp(-t./20).*sin(t);z=t;p1ot3(fyfz);t=0:0.01:1;x=t;y=t.a2;z=t.a3;p1ot3(x,y,z);x=-30:0.1:0;y=0:0.1:30;xzy=meshgr
7、id(,y);z=10.*sin(sqrt(x.2+y.a2).sqrt(1x.2+y.a2);meshe(x,y,z);X=Iinspace(-3,3z100);y=1inspace(-3,3,100);xy=meshgrid(xzy);fxy=-5./(1+x.A2+y.a2);i=find(abs(x)=0.8&abs(y)=O.5);fxy(i)=NaN;surf(xzy,fxy)U=Iinspace(1,IO,100);V=Iinspace(-pi,pi,100);uzv=meshgrid(u,v);x=3.*u.*sin(v);y=2.*u.*cos(v);z=4*u.a2;x=3
8、*u.*sin(v);y=2*u.*cos(v);z=4*u.a2;surf(xzyzz);shadinginterp;1ight(position,1z0z1);t=0:pi/100:2*pi;y=sin(t);comet(tzy)第4章(1) 一、思考题(2) A=eye(3);(3) C=100+(200-100)*rand(5z6);(4) D=1+sqrt(0.2)*randn(1,500);(4)E=ones(size(A);(5)A=A+30*eye(size(A);(6)B=diag(diag(A)二、实验题P=asca1(5);H=hi1b(5);Dp=det(P);Dh=d
9、et(H);Kp=cond(P);Kh=cond(H);P矩阵的性能更好,因为KP较小A=1,-1,2,3;0,9,3,3;7,-5,0,2;23,6,8,3B=3,p工/2,45;32,-76,Sqrt(37);5z72z4.5e-4;exp(2),0,97A1=diag(A);B1=diag(B);A2=triu(A);B2=triu(B);A3=tri1(A);B3=tri1(B);rA=rank(A);rB=rank(B);nA=non(A)nb=nonn(B);cA=cond(A);cB=cond(B);A=31z1z0;-4z-1z0;4z-8z-2;V,D=eig(A);A=diag(-1,-1,-1,-1,-1)+diag(-1z-1z-1,-1z1)+diag(2r2z2,2z2)b=1z0,0,0z0;x1=inv(A)*b;2=Ab;1zU=1u(A);x3=U(1b);Q0.5)/size(A)h=466,715,950,1422,1635;w=7.04,4.28,3.40,2.52,2.13;hh=500z900z1500;ww=interp1(h,w,hh,sp1ine)X=Iinspace(1r10z50);y=1og(x);f=po1yfi