实验五MATLAB7.0二维绘图实验目的:①掌握绘制数据曲线图的方法;②掌握绘制其他坐标系下的数据曲线图和统计分析图的方法;③掌握绘制隐函数图形的方法。④掌握图形修饰处理方法;实验要求:给出程序和实验结果。实验内容:8.编制MATLAB7.0程序,该程序绘制两条曲线,x的取值在[0,2pi],易pi/10为步长,一条是正弦曲线,一条是余弦曲线,线宽为6个象素,正弦曲线为绿色,余弦曲线为红色,线型分别为实线和虚线。给所绘的两条曲线增添图例,分别为“正弦曲线”和“余弦曲线”。9.在同一坐标内,分别用不同线型和颜色绘制曲线y1=0.2e-0.5xcos(4πx)和y2=2e-0.5xcos(πx),标记两曲线交叉点。10.在0≤x≤2区间内,绘制曲线y1=2e-0.5x和y2=cos(4πx),并给图形添加图形标注。11.重新绘制第一题所描述的曲线,将正弦曲线和余弦曲线分别画在两个子图中,子图竖向排列。12、绘制r=sin(t)cos(t)的极坐标图;13、分别以条形图、阶梯图、杆图和填充图形式绘制曲线y=2sin(x)。实验程序与结果:1x=-2:0.1:2;y=sin(x).*cos(x);plot(x,y,'-r')-2-1.5-1-0.500.511.52-0.5-0.4-0.3-0.2-0.100.10.20.30.40.52ezplot('x^2/9+y^2/16-1',[-5,5,-5,5]);xyx2/9+y2/16-1=0-5-4-3-2-1012345-5-4-3-2-10123453x1=-2:0.1:2;x2=-2:0.1:2;y1=sin(x2).*x1;y2=cos(x1).*x2;plot3(x1,x2,y1,'d',x1,x2,y2,'d')-2-1012-2-1012-1-0.500.511.524x1=-2:0.1:2;x2=-2:0.1:2;y1=x1'*sin(x2);y2=x2'*cos(x1);meshc(y1)holdonmeshc(y2)5ezplot('x^2/9+y^2/16-1',[-5,5,-5,5]);xlabel('x(-5--5)');ylabel('y(-5--5)');title('解曲线')x(-5--5)y(-5--5)解曲线-5-4-3-2-1012345-5-4-3-2-10123456x1=-2:0.1:2;x2=-2:0.1:2;y1=sin(x2).*x1;y2=cos(x1).*x2;plot3(x1,x2,y1,'d',x1,x2,y2,'d');text(1,1,'y1=sin(x2).*x1');text(4,4,'y2=cos(x1).*x2')-2-1012-2-1012-1-0.500.511.52y2=cos(x1).*x2y1=sin(x2).*x17x=-2:0.1:2;y=sin(x).*cos(x);plot(x,y,'-r');axis([-3,3,-1.5,1.5])8-3-2-10123-1.5-1-0.500.511.58x=0:pi/10:2*pi;y1=sin(x);y2=cos(x);plot(x,y1,'-g','linewidth',6);holdonplot(x,y2,'r--','linewidth',6);legend('sin','cos','location','NorthWest')01234567-1-0.8-0.6-0.4-0.200.20.40.60.81sincos9x=linspace(0,2*pi,1000);y1=0.2*exp(-0.5*x).*cos(4*pi*x);y2=2*exp(-0.5*x).*cos(pi*x);k=find(abs(y1-y2)1e-2);x1=x(k);y3=0.2*exp(-0.5*x1).*cos(4*pi*x1);plot(x,y1,x,y2,'dg',x1,y3,'bp')01234567-1.5-1-0.500.511.5210x=0:0.1:2*pi;y1=2*exp(-0.5*x);plot(x,y1)holdony2=cos(4*pi*x);plot(x,y2);xlabel('x(0-2\pi)');text(0.5,1.5,'y1=2*exp(-0.5*x)');text(0.5,0.5,'y2=cos(4*pi*x)');legend('y1','y2')01234567-1-0.500.511.52x(0-2)y1=2*exp(-0.5*x)y2=cos(4*pi*x)y1y211x=-2:0.1:2;subplot(2,1,1)y1=sin(x);plot(x,y1,'-r');subplot(2,1,2);y2=cos(x);plot(x,y2)-2-1.5-1-0.500.511.52-1-0.500.51-2-1.5-1-0.500.511.52-0.500.5112t=0:0.1:5;r=sin(t).*cos(t);polar(t,r)0.10.20.30.40.5302106024090270120300150330180013x=0:0.1:10;y=2*sin(x);subplot(2,2,1);bar(x,y);subplot(2,2,2);stairs(x,y)subplot(2,2,3);stem(x,y);subplot(2,2,4);fill(x,y,'g');-5051015-2-10120510-2-10120510-2-10120510-2-1012