matlab答案第五章.docx

上传人:小飞机 文档编号:3161222 上传时间:2023-03-11 格式:DOCX 页数:3 大小:36.82KB
返回 下载 相关 举报
matlab答案第五章.docx_第1页
第1页 / 共3页
matlab答案第五章.docx_第2页
第2页 / 共3页
matlab答案第五章.docx_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

《matlab答案第五章.docx》由会员分享,可在线阅读,更多相关《matlab答案第五章.docx(3页珍藏版)》请在三一办公上搜索。

1、matlab答案第五章第五章 1.绘制下列曲线。 1001-2y= y=e 21+x2px2x=t2x+y=1 3y=5t22答: (1) x=-10:0.1:10; y=100./(1+x.2); plot(x,y) (2) x=-10:0.1:10; y=1/(2*pi)*exp(-x.2/2); plot(x,y) (3) ezplot(x2+y2=1) (4) t=-10:0.1:10; x=t.2; y=5*t.3; plot(x,y) 2. 绘制下列三维图形。 x=costy=sint z=tx=(1+cosu)cosvy=(1+cosu)sinv z=sinuz=5 答: (1)

2、 t=0:pi/100:2*pi; x=cos(t); y=sin(t); z=t; plot3(x,y,z) 半径为10的球面y=2x-0.5 x=sin(3t)cost0tp y=sin(3t)sint答: 相邻两点x1、x2 曲线相应的y值为y11、y12, 曲线y相应的y值y21、y22, 若(y11-y21)与(y12-y22)符号相反或等于0,则x1或x2就是一个交叉点。 方法一: t=linspace(0,pi,300); x=sin(3*t).*cos(t); y1=2*x-0.5; y2=sin(3*t).*sin(t); len=length(t); p=y1-y2; x3

3、=x(find(p(1:len-1).*p(2:len)=0); y3=2*x3-0.5; plot(x,y1,x,y2,x3,y3,rd) 方法二:用循环 %t=0:0.01:pi; t=linspace(0,pi,100); x=sin(3*t).*cos(t); y1=2*x-0.5; y2=sin(3*t).*sin(t); plot(x,y1,x,y2);grid; delta_y=y1-y2; % figure;stem(delta_y); j=1; for i=1:length(t)-1 if delta_y(i)*delta_y(i+1)=0 position(j)=i+1; j=j+1; end end hold on; plot(x(position),y1(position),ro); title(两条曲线相交); xlabel(x);ylabel(y); h = legend(y1,y2);

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号