收藏 分销(赏)

MATLAB实验六 高层绘图操作.doc

上传人:xrp****65 文档编号:7590027 上传时间:2025-01-09 格式:DOC 页数:4 大小:269KB 下载积分:10 金币
下载 相关 举报
MATLAB实验六 高层绘图操作.doc_第1页
第1页 / 共4页
MATLAB实验六 高层绘图操作.doc_第2页
第2页 / 共4页


点击查看更多>>
资源描述
光电073-1 刘颖 200713503117 实验六 高层绘图操作 运行结果: 1.设y=,在x=2π区间取101点,绘制函数的曲线. 程序设计: x=0:pi/50:2*pi; y=(0.5+3*sin(x)./(1+x.^2)).*cos(x); plot(x,y) 2.已知,完成下列操作: (1)在同一坐标系下用不同的颜色和线性绘制三条曲线。 运行结果: 程序设计: close all x=(0:pi/100:2*pi)'; y1=x.^2; y2=cos(2*x); y3=y1.*y2; plot(x,y1,'m.'); hold on; plot(x,y2,'g-.'); hold on; plot(x,y3,'y--'); hold off (2)以子图形式绘制三条曲线。 运行结果: 程序设计: close all x=(0:pi/100:2*pi)'; y1=x.^2; y2=cos(2*x); y3=y1.*y2; subplot(3,1,1); plot(x,y1); title('y1'); subplot(3,1,2); plot(x,y2); title('y2'); subplot(3,1,3); plot(x,y3); title('y3'); (3)分别用条形图、阶梯图、杆图和填充图绘制三条曲线。 程序设计: close all x=(0:pi/100:2*pi)'; y1=x.^2; y2=cos(2*x); y3=y1.*y2; subplot(3,4,1);bar(x,y1,'y');title('bar(x,y1,"y")'); subplot(3,4,2);stairs(x,y1,'m');title('stairs(x,y1,"m")'); subplot(3,4,3);stem(x,y1,'g');title('stem(x,y1,"g")'); subplot(3,4,4);fill(x,y1,'c');title('fill(x,y1,"c")'); subplot(3,4,5);bar(x,y2,'y');title('bar(x,y2,"y")'); subplot(3,4,6);stairs(x,y2,'m');title('stairs(x,y2,"m")'); subplot(3,4,7);stem(x,y2,'g');title('stem(x,y2,"g")'); subplot(3,4,8);fill(x,y2,'c');title('fill(x,y2,"c")'); subplot(3,4,9);bar(x,y3,'y');title('bar(x,y3,"y")'); subplot(3,4,10);stairs(x,y3,'m');title('stairs(x,y3,"m")'); subplot(3,4,11);stem(x,y3,'g');title('stem(x,y3,"g")'); subplot(3,4,12);fill(x,y3,'c');title('fill(x,y3,"c")'); 运行结果: 3.已知 在-5区间绘制函数曲线。 程序设计: close all x=-5:0.1:5; 运行结果: if x<=0 y=(x+sqrt(pi))./(exp(2)); else y=1/2*(log(x+sqrt(1+x.^2))); end y plot(x,y) 4.绘极坐标曲线ρ=asin(b+nθ),并分析参数a、b、n对曲线形状的影响。 运行结果: 程序设计: close all a=input('请输入a='); b=input('请输入b='); n=input('请输入n='); theta=0:0.01:2*pi; rho=a*sin(b+n*theta); polar(theta,rho,'k') 运行结果: 请输入a=1 请输入b=2 请输入n=3 5.绘制函数的曲面图和等高线 其中x的21个值均匀分布在[-5,5]范围,y的31个值均匀分布在[0,10],要求使用subplot(2,1,1)和subplot(2,1,2)将产生的曲面图和等高线图画在同一个窗口上。 程序设计: close all x=-5:0.5:5; y=0:1/3:10; [x,y]=meshgrid(x,y); z=cos(x).*cos(y).*exp(-(sqrt(x.^2+y.^2)/4)); subplot(2,2,1); surf(x,y,z); subplot(2,2,2); contour3(x,y,z); 运行结果: 6.绘制曲面图形,并进行插值着色处理。 程序设计: s=0:0.05:pi/2; t=0:0.05:3*pi/2; [s,t]=meshgrid(s,t); [x,y,z]=peaks(30); x=cos(s).*cos(t); y=cos(s).*sin(t); z=sin(s); surf(x,y,z);shading flat; 运行结果: 4
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 应用文书 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服