MATLAB程序设计教程第二版课后详解

上传人:壹****1 文档编号:506611327 上传时间:2023-03-07 格式:DOC 页数:16 大小:78.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、实用标准文案un it3-8MATLAB二版课后答案unit3实验指导1、n=in put(请输入一个三位数:);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;otherwisep=E;endprice=p(2) n=input(请输入成绩);if n=90&n =80

2、&n =70&n =60&n aa=n( m);elseif n(m)bb=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;mi n=mi n(n)max=max (n)4b=-3.0:0.1:3.0;for n=1:61a=b( n);y(n )=(exp(0.3*a)-exp(-0.3*a)/2*si n(a+0.3)+log(0.3+a)/2);endy5y1=0;y2=1;n=input(请输入n的值:);for i=1: ny1= y1+1/iA2;y2=y2*(4*i*i)/(2

3、*i-1)*(2*i+1);endyiy26A=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=0disp(A( n,:);elseif n0disp(lasterr);else disp(A(6,:);disp(lasterr);end7(1)f=;for n=1:40f(n )=n+10*log( n2+5);endy=f(40)/(f(30)+f(20)(2)f=;a=0;for n=1:40f(n )=a+n*( n+1);a=f(n);endy=

4、f(40)/(f(30)+f(20)8y=0;m=input(输入 m的值:);n=input(输入 n 值:);for i=1: ny=y+iAm;endy*function s=shi8_1( n,m)s=0;for i=1: ns=s+jAm;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.A23s=fix(100*ra nd(1,20)*9/10+10)y=sum(s)/20j=0;for i=1:20if s(i) y&rem(s(i),2)=0j=j+1;A(j)=s(i)

5、;else con ti nue;endendA4y1=0;y2=0;n=input(请输入n的值:); for i=1: ny1= y1+-(-1)Ai/(2*i-1); y2=y2+1/4Ai;endyiy2unit4实验指导1 (1) x=-10:0.05:10; y=x-x.A3./6;Plot(x,y)(2)x=-10:0.5:10;ezplot(xA2+2*yA2-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); s

6、ubplot(2,2,2); stairs(t,y,b);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.*(s in (t).A2)./cos(t); polar(t

7、,r);4 (1)t=0:pi/50:2*pi; x=exp(-t./20).*cos(t); y=exp(-t./20).*si n( t);z=t;plot3(x,y,z);grid on;(2)x,y=meshgrid(-5:5); z=zeros(11)+5; mesh(x,y,z);shad ing in terp;5x,y,z=sphere(20); surf(x,y,z);axis off;shad ing in terp;m=moviei n(20);for i=1:20axis(-i,i,-i,i,-i,i)m(:,i)=getframe;endmovie(m,4);思考练习

8、2 (1)x=-5:0.1:5;y=(1./(2*pi).*exp(-(x.A2)/2); plot(x,y);(2)t=-2*pi:0.1:2*pi;x=t.*s in( t);y=t.*cos(t); plot(x,y);grid on;3t=O:pi/1OOO:pi;x=si n(3.*t).*cos(t);y1=si n(3.*t).*si n( t);y2=2.*x-0.5; plot(x,y1,k,x,y2); hold on;k=fi nd(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=max(p)N,H=mi n(p)jun zhi=mea n( p,1)fan gcha=std(p,1,1)zon g=sum(p,2);Max,wei=max(z ong)Mi n, wei=mi n(zong)zcj,xsxh=sort(z on g,desce nd)6x=

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

当前位置:首页 > 资格认证/考试 > 自考

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