资源描述:
《《matlab及在电子信息类课程中的应用》习题答案 电子科大 第二版》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、第二章1、x=[2,4];y=x.^3+(x-0.98).^2./(x+1.35).^3-5*(x+1./x)2、y=cos(pi/3)-(9-sqrt(2))^(1/3)3、a=3;A=4;b=a.^2;B=b.^2-1;c=a+A-2*B;C=a+2*B+c4、x=[123;456;789]Desktop->Workspace,双击变量x5、clearx=magic(3)y=randn(3,3)xy=[x,y]yx=[x,y]z=xy(:,1:2)6、clearx=eye(4,4)y=triu(x)7
2、、clearx=rand(4,5)y=x([1,2],:)z=(y>=0.3).*y8、clearx=randn(5,5)y=inv(x)9、clearx=randn(5,5)z=x^510、clearA=[1,4,8;-3,6,-5;2,-7,-12];B=[5,4,3;6,-2,3;-1,3,-9];C=A*BD=A.*B11、clearx=linspace(0,2*pi,125);y=cos(x).*(0.5+3*sin(x)./(1+x.^2));plot(x,y)12、z=-45:1:45;x=
3、z.*sin(3*z);y=z.*cos(3*z);plot3(x,y,z);13、x=-2:0.1:2,y=x;[x,y]=meshgrid(x,y);z=x.^2.*exp(-x.^2-y.^2)surf(x,y,z);14、x=-2:0.1:2,y=x;[x,y]=meshgrid(x,y);z=x.^2.*exp(-x.^2-y.^2);surf(x,y,z);z1=0.05*x-0.05*y+0.1;holdon,mesh(x,y,z1);15、(1)n=2;alfa=0;t=0:0.1:10;
4、x=cos(t);y=sin(n*t+alfa);subplot(2,2,1);plot(t,x,t,y);(2)n=2;alfa=0;t=0:0.1:10;x=cos(t);y=sin(n*t+alfa);subplot(2,2,1);plot(t,x,t,y);n=2;alfa=pi/3;t=0:0.1:10;x=cos(t);y=sin(n*t+alfa);subplot(2,2,2);plot(t,x,t,y);n=2;alfa=pi/2;t=0:0.1:10;x=cos(t);y=sin(n*t
5、+alfa);subplot(2,2,3);plot(t,x,t,y);n=2;alfa=pi;t=0:0.1:10;x=cos(t);y=sin(n*t+alfa);subplot(2,2,4);plot(t,x,t,y);球体clearfori=1:100forj=1:100x(i,j)=i/100*cos(j*2*pi/100);y(i,j)=i/100*sin(j*2*pi/100);z(i,j)=sqrt(1.001-x(i,j)^2-y(i,j)^2);endendsurf(x,y,z);ho
6、ldon;surf(x,y,-z);axisequal棱锥clearfori=1:100forj=1:100x(i,j)=i/100*cos(j*2*pi/4);y(i,j)=i/100*sin(j*2*pi/4);z(i,j)=sqrt(x(i,j)^2+y(i,j)^2);endendsurf(x,y,-z);求最大值x=[6787569943]max=0;fori=1:5ifmax>=x(i)max=max;elsemax=x(i)endendmax求最小值x=[6787569943]min=inf
7、;fori=1:5ifmin<=x(i)min=min;elsemin=x(i)endendmin求和x=[6787569943];sum=0;fori=1:5sum=sum+x(i)endsum第三章1、h0=[446,714,950,1422,1634];t0=[7.04,4.28,3.40,2.54,2.13];t1=interp1(h0,t0,500,'linear')2、x0=[1,0,-1];y0=[0,1,0];p=polyfit(x0,y0,3);x=-1:0.1:1;y=polyval(
8、p,x);plot(x,y,-x,-y),axisequal3、clearx0=[1.0,1.1,1.2,1.3,1.4];y0=[0.25,0.2268,0.2066,0.1890,0.1736];p=polyfit(x0,y0,3);p1=polyder(p);y=polyval(p1,[1.0,1.2])4、p=[3472912];r=roots(p)5、r=[-3-5-8-9];p=poly(r)6、functiony