《数学实验》报告
实验名称 MATLAB绘图
学院
专业班级
姓名
学号
年月
一、 【实验目的】
了解并学习绘制MATLAB 二维曲线和三维曲线的图形。
二、 【实验任务】
1.绘制)π4,0(),3sin(3
∈=x x e y x 的图像,要求用蓝色的星号画图,并且画出其包络线3
x e y ±=的图像,用红色的点划线画图。
3.在同一图形窗口画三个子图,要求使用指令gtext ,axis ,legend ,title ,xlabel ,ylabel : (1))ππ,(,cos -∈=x x x y (2))π,4π(,sin 1
tan
3∈=x x x
x y (3)]8,1[,sin 1∈=x x e y x
5.绘制圆锥螺线的图像并加各种备注,圆锥螺线的参数方程为:
π]20,0[,t
2z 6π
sin 6π
cos {
∈===t t t y t
t x
三、 【实验程序】
1.
x=0:pi/50:4*pi; y1=exp(x/3).*sin(3*x); y2=exp(x/3); y3=-exp(x/3); plot(x,y1,'b*') hold on
plot(x,y2,'r-.') hold on plot(x,y3,'r-.')
3.
x1=-pi:pi/50:pi; y1=x1.*cos(x1); x2=pi:pi/50:4*pi;
y2=x2.*tan(1./x2).*sin(x2.^3); x3=1:0.01:8;
y3=exp(1./x3).*sin(x3);
subplot(221),plot(x1,y1,'r-'),grid on axis tight
xlabel('x 轴'),ylabel('y 轴') title('y=xcosx')
gtext('y=xcosx')
legend('y=xcosx')
subplot(222),plot(x2,y2,'b--'),grid on
axis tight
xlabel('x轴'),ylabel('y轴')
title('y=xtan(1/x)sinx^3')
gtext('y=xtan(1/x)sinx^3')
legend('y=xtan(1/x)sinx^3')
subplot('position',[0.2,0.05,0.6,0.45]),plot(x2,y2,'m'),grid on axis tight
xlabel('x轴'),ylabel('y轴')
title('y=exp(1/x)sinx')
gtext('y=exp(1/x)sinx')
legend('y=exp(1/x)sinx')
5.
t=0:pi/10:20*pi;
x=t.*cos(pi*t/6);
y=t.*sin(pi*t/6);
z=2*t;
plot3(x,y,z)
四、【实验结果】
1.
3.
5.
五、【实验总结】
了解了MATLAB绘制二维和三维图形的方法,掌握了各种指令和控制方法,并且经过实践运用MATLAB进行了图形绘制。