教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 高等教育 >

MATLAB作业1 参考答案(2)

来源:网络收集 时间:2026-05-05
导读: for i=1:29999 x(i+1)=1+y(i)-1.4*x(i)^2; y(i+1)=0.3*x(i); end plot(x,y,'.') 上述的算法由于动态定义x 和y,所以每循环一步需要重新定维,这样做是很消耗时间的,所以为加快速度,可以考虑预先定义这两个变量,

for i=1:29999

x(i+1)=1+y(i)-1.4*x(i)^2; y(i+1)=0.3*x(i); end

plot(x,y,'.')

上述的算法由于动态定义x 和y,所以每循环一步需要重新定维,这样做是很消耗时间的,所以为加快速度,可以考虑预先定义这两个变量,如给出x=zeros(1,30000)。

11、选择合适的步距绘制出下面的图形sin(),其中t?(?1,1)。(注:合适的步距包括等距

t1与不等距)

【求解】用普通的绘图形式,选择等间距,得出所示的曲线,其中x = 0 左右显得粗糙。 >> t=-1:0.03:1; y=sin(1./t); plot(t,y) 选择不等间距方法,可以得出曲线。

>> t=[-1:0.03: -0.25, -0.248:0.001:0.248, 0.25:.03:1]; y=sin(1./t); plot(t,y)

12、对合适的?范围选取分别绘制出下列极坐标图形(注:要求把图形窗口分为4块,每块绘一个图)

①??1.0013?,②??cos(7?/2),③??sin(?)/?,④??1?cos(7?)

【求解】绘制极坐标曲线的方法很简单,用polar( ) 即可以绘制出极坐标图。注意绘制图形时的点运算:

>> t=0:0.01:2*pi; subplot(221), polar(t,1.0013*t.^2),% (a) subplot(222), t1=0:0.01:4*pi; polar(t1,cos(7*t1/2)) % (b) subplot(223), polar(t,sin(t)./t) % (c) subplot(224), polar(t,1-(cos(7*t)).^3)

theta=[-pi:pi/100:pi]; rho=1.0031*theta.^2; subplot(221) polar(theta,rho); axis off; shading interp; rho=cos(7*theta/2); subplot(222) polar(theta,rho); rho=sin(theta)./theta; subplot(223) polar(theta,rho)

rho=1-(cos(7*theta)).^3; subplot(224) polar(theta,rho)

23

13、请分别绘制出xy 和sin(xy) 的三维图和等高线。 【求解】(a) 给出下面命令即可得出的图形。 >> [x,y]=meshgrid(-1:.1:1);

surf(x,y,x.*y), figure; contour(x,y,x.*y,30) (b) 给出下面命令即可得出的图形。 >> [x,y]=meshgrid(-pi:.1:pi);

surf(x,y,sin(x.*y)), figure; contour(x,y,sin(x.*y),30)

t=0:pi/100:2*pi; x=sin(t); y=cos(t); z=x.*y; subplot(321) plot3(x,y,z);

[x,y]=meshgrid(1:0.01:10); z=x.*y; subplot(322); contour3(x,y,z); subplot(323); surf(x,y,z); z=sin(x.*y); subplot(324); surf(x,y,z); subplot(325); contour3(x,y,z);

MATLAB作业1 参考答案(2).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/616168.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)