MATLAB程序设计教程第二版课后答案

上传人:枫** 文档编号:475893893 上传时间:2023-02-02 格式:DOC 页数:16 大小:99.50KB
返回 下载 相关 举报
MATLAB程序设计教程第二版课后答案_第1页
第1页 / 共16页
MATLAB程序设计教程第二版课后答案_第2页
第2页 / 共16页
MATLAB程序设计教程第二版课后答案_第3页
第3页 / 共16页
MATLAB程序设计教程第二版课后答案_第4页
第4页 / 共16页
MATLAB程序设计教程第二版课后答案_第5页
第5页 / 共16页
点击查看更多>>
资源描述

《MATLAB程序设计教程第二版课后答案》由会员分享,可在线阅读,更多相关《MATLAB程序设计教程第二版课后答案(16页珍藏版)》请在金锄头文库上搜索。

1、MATLAB第二版课后答案unit3-8unit3实验指导1、 n=input(请输入一个三位数:);a=fix(n/100);b=fix(n-a*100)/10);c=n-a*100-b*10;d=c*100+b*10+a2(1)n=input(请输入成绩);switch ncase num2cell(90:100) p=A;case num2cell(80:89) p=B;case num2cell(70:79) p=C;case num2cell(60:69) p=D;otherwise p=E;endprice=p(2)n=input(请输入成绩);if n=90&n=80&n=70&

2、n=60&na a=n(m); elseif n(m)b b=n(m); endendmax=amin=b法2n=1,5,56,4,3,476,45,6,3,76,45,6,4,3,6,4,23,76,908,6;min=min(n)max=max(n)4b=-3.0:0.1:3.0;for n=1:61 a=b(n);y(n)=(exp(0.3*a)-exp(-0.3*a)/2*sin(a+0.3)+log(0.3+a)/2);endy5y1=0;y2=1;n=input(请输入n的值:);for i=1:n y1=y1+1/i2; y2=y2*(4*i*i)/(2*i-1)*(2*i+1)

3、;endy1y26A=1,1,1,1,1,1;2,2,2,2,2,2;3,3,3,3,3,3;4,4,4,4,4,4;5,5,5,5,5,5;6,6,6,6,6,6;n=input(请输入n的值:);if n=0 disp(A(n,:);elseif n0 disp(lasterr);else disp(A(6,:); disp(lasterr);end 7(1)f=;for n=1:40 f(n)=n+10*log(n2+5);end y=f(40)/(f(30)+f(20)(2)f=;a=0;for n=1:40 f(n)=a+n*(n+1); a=f(n);endy=f(40)/(f(3

4、0)+f(20)8y=0;m=input(输入m的值:);n=input(输入n值:);for i=1:n y=y+im;endy*function s=shi8_1(n,m)s=0;for i=1:n s=s+im;end*shi8_1(100,1)+shi8_1(50,2)+shi8_1(10,1/2)思考练习2N=1,2,3,4,5;2.*NN./21./N1./N.23s=fix(100*rand(1,20)*9/10+10)y=sum(s)/20j=0;for i=1:20 if s(i)y&rem(s(i),2)=0 j=j+1; A(j)=s(i); else continue;

5、 endendA4y1=0;y2=0;n=input(请输入n的值:);for i=1:n y1=y1+-(-1)i/(2*i-1); y2=y2+1/4i;endy1y2unit4实验指导1(1)x=-10:0.05:10;y=x-x.3./6;plot(x,y)(2)x=-10:0.5:10; ezplot(x2+2*y2-64,-8,8); grid on;2t=-pi:pi/10:pi;y=1./(1+exp(-t);subplot(2,2,1);bar(t,y);title(条形图(t,y);axis(-pi,pi,0,1);subplot(2,2,2);stairs(t,y,b);

6、title(阶梯图(t,y);axis(-pi,pi,0,1);subplot(2,2,3);stem(t,y,k);title(杆图(t,y);axis(-pi,pi,0,1);subplot(2,2,4);loglog(t,y,y);title(对数坐标图(t,y);3(1)t=0:pi/50:2*pi;r=5.*cos(t)+4;polar(t,r);title(rho=5*costheta+4);(2)t=-pi/3:pi/50:pi/3;r=5.*(sin(t).2)./cos(t);polar(t,r);4(1)t=0:pi/50:2*pi;x=exp(-t./20).*cos(t

7、);y=exp(-t./20).*sin(t);z=t;plot3(x,y,z);grid on; (2)x,y=meshgrid(-5:5);z=zeros(11)+5;mesh(x,y,z);shading interp;5x,y,z=sphere(20);surf(x,y,z);axis off;shading interp;m=moviein(20);for i=1:20 axis(-i,i,-i,i,-i,i) m(:,i)=getframe;endmovie(m,4); 思考练习2(1)x=-5:0.1:5;y=(1./(2*pi).*exp(-(x.2)/2);plot(x,y);(2)t=-2*pi:0.1:2*pi;x=t.*sin(t);y=t.*cos(t);plot(x,y);grid on;3t=0:pi/1000:pi;x=sin(3.*t).*cos(t);y1=sin(3.*t).*sin(t);y2=2.*x-0.5;plot(x,y1,k,x,y2);hold on;k=find(abs(y1-y2)0.5) n=n+1; endendny=n/300005p=45,74,54,55,14;78,98,45,74,12;87,98,85,52,65M,S=ma

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 工作计划

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号