资源描述:
《matlab 程序设计教程(第二版)刘卫国 课后参考答案》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、第二章1求下列表达式的值。(1)w=sqrt(2)*(1+0.34245*10^(-6))(2)a=3.5;b=5;c=-9.8;x=(2*pi*a+(b+c)/(pi+a*b*c)-exp(2))/tan(b+c)+a(3)a=3.32;b=-7.9;y=2*pi*a^(2)*[(1-pi/4)*b-(0.8333-pi/4)*a](4)t=[2,1-3*i;5,-0.65];z=1/2*exp(2*t)*log(t+sqrt(1+t^(2)))2求下列表达式A=[-1,5,-4;0,7,8;3,61,7];B=[8,3,-1;2,5,3;-3,2,0];(
2、1)A+6*BA^2-B+eye(2)A*BA.*BB.*A(3)A/BBA(4)[A,B][A([1,3],:);B^2]3根据已知,完成下列操作(1)A=[23,10,-0.778,0;41,-45,65,5;32,5,0,32;6,-9.54,54,3.14];K=find(A>10&A<25);A(K)(2)A=[23,10,-0.778,0;41,-45,65,5;32,5,0,32;6,-9.54,54,3.14];B=A(1:3,:)C=A(:,1:2)D=A(2:4,3:4)E=B*C(3)E3、D~E
4、~D第三章1从键盘输入一个3
5、位数,将它反向输出,如输入639,出数936。f=input('输入一个数:','s');f(end:-1:1)2用if语句score=input('请输入成绩:');ifscore>=90&&score<=100disp('A');elseifscore>=80&&score<=89disp('B');elseifscore>=70&&score<=79disp('C');elseifscore>=60&&score<=69;disp('D');elseifscore<60&&score>=0;disp('E');elsedisp('出错');end用swi
6、tch语句score=input('请输入成绩:');switchfix(score/10)case{9,10}disp('A');case{8}disp('B');case{7}disp('C');case{6}disp('D');case{0,1,2,3,4,5}disp('E');otherwisedisp('出错');end第四章1题1)X=0:10;Y=x-x.^3/6;Plot(x,y)2)t=0:0.01:2*pi;x=8.*cos(t);y=4*sqrt(2).*sin(t);plot(x,y)2题M文件:t=-pi:pi/10:pi;y=1.
7、/(1+exp(-t));subplot(2,2,1);bar(t,y,'b');title('bar(t,y,''b'')');axis([-5,5,-3,3]);subplot(2,2,2);stairs(t,y,'k');title('stairs(t,y,''k'')');axis([-5,5,-3,3]);subplot(2,2,3);stem(t,y,'m');title('stem(t,y,''m'')');axis([-5,5,-3,3]);subplot(2,2,4);loglog(t,y,'g');title('loglog(t,y,''g
8、'')');axis([-5,5,-3,3]);3题1)t=0:pi/100:2*pi;y=5*cos(t)+4;polar(t,y,'-*')2)t=-pi/3:pi/100:pi/3;r=5*sin(t).^2./cos(t);polar(t,r,'-*')4题1)t=0:pi/100:2*pi;x=exp(-t/20).*cos(t);y=exp(-t/20).*sin(t);z=t;plot3(x,y,z)第五章:1题A=randn(10,5)1)X=mean(A)Y=std(A,0,1)2)max(max(A))min(min(A))3)B=sum(
9、A,2)sum(B)4)sort(A);sort(A,2,'descend')2题1)t=0:15:90;x1=[0,0.2588,0.5000,0.7071,0.8660,0.9659,1.0000];a1=0:1:90;y1=interp1(t,x1,a1,'spline')x2=[0,0.2679,0.5774,1.0000,1.7320,3.7320,NaN];a2=0:1:75;y2=interp1(t,x2,a2,'spline')p1=polyfit(t,x1,5);z1=polyval(p1,a1)p2=polyfit(t,x2,5);z2=p
10、olyval(p2,a2)4题P=[2