matlab实验六报告.docx
- 文档编号:6508578
- 上传时间:2023-01-07
- 格式:DOCX
- 页数:37
- 大小:99.27KB
matlab实验六报告.docx
《matlab实验六报告.docx》由会员分享,可在线阅读,更多相关《matlab实验六报告.docx(37页珍藏版)》请在冰豆网上搜索。
matlab实验六报告
实验六MATLAB数据可视化
实验者:
祝松年级:
机设092学号:
09405701002
一、实验目的
掌握MATLAB二维、三维图形绘制,掌握图形属性的设置和图形修饰;掌握图像文件的读取和显示。
二、实验内容
(1)二维图形绘制。
(2)三维曲线和三维曲面绘制。
(3)图像文件的读取和显示。
三、实验步骤
1.二维图形绘制
(1)二维图形绘制主要使用函数plot。
>>clearall;
>>x=linspace(0,2*pi,100);
>>y1=sin(x);
>>plot(x,y)
>>holdon%保持原有的图形
>>y2=cos(x)
>>plot(x,y)
注:
holdon用于保持图形窗口中原有的图形,holdoff解除保持。
(2)函数plot的参数也可以是矩阵。
>>closeall%关闭所有图形窗口
>>x=linspace(0,2*pi,100);
>>y1=sin(x);
>>y2=cos(x);
>>A=[y1;y2]';%把矩阵转置
>>B=[x;x]'
>>plot(B,A)
(3)选用绘图线形和颜色。
>>closeall%关闭所有图形窗口
>>plot(x,y1,'g+',x,y2,'r:
')
>>gridon%添加网格线
(4)添加文字标注。
>>title('正弦曲线和余弦曲线')
>>ylabel('幅度')
>>xlabel('时间')
>>legend('sin(x)','cos(x)')
>>gtext('\leftarrowsinx')%可用鼠标选择标注的位置,
%\leftarrow产生左箭头,‘\’为转义符
(5)修改坐标轴范围。
>>axisequal
>>axisnormal
>>axis([0pi01.5])
(6)子图和特殊图形绘制。
>>subplot(2,2,1)
>>t1=0:
0.1:
3;
>>y1=exp(-t1);
>>bar(t1,y1);
>>subplot(2,2,2)
>>t2=0:
0.2:
2*pi;
>>y2=sin(t2);
>>stem(t2,y2);
>>subplot(2,2,3)
>>t3=0:
0.1:
3;
>>y3=t3.^2+1;
>>stairs(t3,y3);
>>subplot(2,2,4)
>>t4=0:
.01:
2*pi;
>>y4=abs(cos(2*t4));
>>polar(t4,y4);
练习:
写出图A2的绘制方法。
提示:
按照以下的步骤进行
(1)产生曲线的数据(共有3组数据);
(2)选择合适的线形、标记、颜色(正弦曲线为红色,余弦曲线为紫色);(3)添加图例及文字说明信息;(4)添加坐标轴说明与图标题。
四、实验报告结果
>>clearall
>>x=linspace(0,2*pi,100)
x=
Columns1through11
00.06350.12690.19040.25390.31730.38080.44430.50770.57120.6347
Columns12through22
0.69810.76160.82510.88850.95201.01551.07891.14241.20591.26931.3328
Columns23through33
1.39631.45971.52321.58671.65011.71361.77711.84051.90401.96752.0309
Columns34through44
2.09442.15792.22132.28482.34832.41172.47522.53872.60212.66562.7291
Columns45through55
2.79252.85602.91952.98293.04643.10993.17333.23683.30033.36373.4272
Columns56through66
3.49073.55413.61763.68113.74453.80803.87153.93493.99844.06194.1253
Columns67through77
4.18884.25234.31574.37924.44274.50614.56964.63314.69654.76004.8235
Columns78through88
4.88694.95045.01395.07735.14085.20435.26775.33125.39475.45815.5216
Columns89through99
5.58515.64855.71205.77555.83895.90245.96596.02936.09286.15636.2197
Column100
6.2832
>>y1=sin(x)
y1=
Columns1through11
00.06340.12660.18930.25110.31200.37170.42980.48620.54060.5929
Columns12through22
0.64280.69010.73460.77610.81460.84970.88150.90960.93410.95490.9718
Columns23through33
0.98480.99380.99890.99990.99690.98980.97880.96380.94500.92240.8960
Columns34through44
0.86600.83260.79580.75570.71270.66680.61820.56710.51370.45820.4009
Columns45through55
0.34200.28170.22030.15800.09510.0317-0.0317-0.0951-0.1580-0.2203-0.2817
Columns56through66
-0.3420-0.4009-0.4582-0.5137-0.5671-0.6182-0.6668-0.7127-0.7557-0.7958-0.8326
Columns67through77
-0.8660-0.8960-0.9224-0.9450-0.9638-0.9788-0.9898-0.9969-0.9999-0.9989-0.9938
Columns78through88
-0.9848-0.9718-0.9549-0.9341-0.9096-0.8815-0.8497-0.8146-0.7761-0.7346-0.6901
Columns89through99
-0.6428-0.5929-0.5406-0.4862-0.4298-0.3717-0.3120-0.2511-0.1893-0.1266-0.0634
Column100
-0.0000
>>plot(x,y1)
>>holdon
>>y2=cos(x)
y2=
Columns1through11
1.00000.99800.99200.98190.96790.95010.92840.90290.87380.84130.8053
Columns12through22
0.76600.72370.67850.63060.58010.52720.47230.41540.35690.29690.2358
Columns23through33
0.17360.11080.0476-0.0159-0.0792-0.1423-0.2048-0.2665-0.3271-0.3863-0.4441
Columns34through44
-0.5000-0.5539-0.6056-0.6549-0.7015-0.7453-0.7861-0.8237-0.8580-0.8888-0.9161
Columns45through55
-0.9397-0.9595-0.9754-0.9874-0.9955-0.9995-0.9995-0.9955-0.9874-0.9754-0.9595
Columns56through66
-0.9397-0.9161-0.8888-0.8580-0.8237-0.7861-0.7453-0.7015-0.6549-0.6056-0.5539
Columns67through77
-0.5000-0.4441-0.3863-0.3271-0.2665-0.2048-0.1423-0.0792-0.01590.04760.1108
Columns78through88
0.17360.23580.29690.35690.41540.47230.52720.58010.63060.67850.7237
Columns89through99
0.76600.80530.84130.87380.90290.92840.95010.96790.98190.99200.9980
Column100
1.0000
>>plot(x,y2)
>>closeall
>>x=linspace(0,2*pi,100)
x=
Columns1through11
00.06350.12690.19040.25390.31730.38080.44430.50770.57120.6347
Columns12through22
0.69810.76160.82510.88850.95201.01551.07891.14241.20591.26931.3328
Columns23through33
1.39631.45971.52321.58671.65011.71361.77711.84051.90401.96752.0309
Columns34through44
2.09442.15792.22132.28482.34832.41172.47522.53872.60212.66562.7291
Columns45through55
2.79252.85602.91952.98293.04643.10993.17333.23683.30033.36373.4272
Columns56through66
3.49073.55413.61763.68113.74453.80803.87153.93493.99844.06194.1253
Columns67through77
4.18884.25234.31574.37924.44274.50614.56964.63314.69654.76004.8235
Columns78through88
4.88694.95045.01395.07735.14085.20435.26775.33125.39475.45815.5216
Columns89through99
5.58515.64855.71205.77555.83895.90245.96596.02936.09286.15636.2197
Column100
6.2832
>>y1=sin(x)
y1=
Columns1through11
00.06340.12660.18930.25110.31200.37170.42980.48620.54060.5929
Columns12through22
0.64280.69010.73460.77610.81460.84970.88150.90960.93410.95490.9718
Columns23through33
0.98480.99380.99890.99990.99690.98980.97880.96380.94500.92240.8960
Columns34through44
0.86600.83260.79580.75570.71270.66680.61820.56710.51370.45820.4009
Columns45through55
0.34200.28170.22030.15800.09510.0317-0.0317-0.0951-0.1580-0.2203-0.2817
Columns56through66
-0.3420-0.4009-0.4582-0.5137-0.5671-0.6182-0.6668-0.7127-0.7557-0.7958-0.8326
Columns67through77
-0.8660-0.8960-0.9224-0.9450-0.9638-0.9788-0.9898-0.9969-0.9999-0.9989-0.9938
Columns78through88
-0.9848-0.9718-0.9549-0.9341-0.9096-0.8815-0.8497-0.8146-0.7761-0.7346-0.6901
Columns89through99
-0.6428-0.5929-0.5406-0.4862-0.4298-0.3717-0.3120-0.2511-0.1893-0.1266-0.0634
Column100
-0.0000
>>y2=cos(x)
y2=
Columns1through11
1.00000.99800.99200.98190.96790.95010.92840.90290.87380.84130.8053
Columns12through22
0.76600.72370.67850.63060.58010.52720.47230.41540.35690.29690.2358
Columns23through33
0.17360.11080.0476-0.0159-0.0792-0.1423-0.2048-0.2665-0.3271-0.3863-0.4441
Columns34through44
-0.5000-0.5539-0.6056-0.6549-0.7015-0.7453-0.7861-0.8237-0.8580-0.8888-0.9161
Columns45through55
-0.9397-0.9595-0.9754-0.9874-0.9955-0.9995-0.9995-0.9955-0.9874-0.9754-0.9595
Columns56through66
-0.9397-0.9161-0.8888-0.8580-0.8237-0.7861-0.7453-0.7015-0.6549-0.6056-0.5539
Columns67through77
-0.5000-0.4441-0.3863-0.3271-0.2665-0.2048-0.1423-0.0792-0.01590.04760.1108
Columns78through88
0.17360.23580.29690.35690.41540.47230.52720.58010.63060.67850.7237
Columns89through99
0.76600.80530.84130.87380.90290.92840.95010.96790.98190.99200.9980
Column100
1.0000
>>A=[y1;y2]'
A=
01.0000
0.06340.9980
0.12660.9920
0.18930.9819
0.25110.9679
0.31200.9501
0.37170.9284
0.42980.9029
0.48620.8738
0.54060.8413
0.59290.8053
0.64280.7660
0.69010.7237
0.73460.6785
0.77610.6306
0.81460.5801
0.84970.5272
0.88150.4723
0.90960.4154
0.93410.3569
0.95490.2969
0.97180.2358
0.98480.1736
0.99380.1108
0.99890.0476
0.9999-0.0159
0.9969-0.0792
0.9898-0.1423
0.9788-0.2048
0.9638-0.2665
0.9450-0.3271
0.9224-0.3863
0.8960-0.4441
0.8660-0.5000
0.8326-0.5539
0.7958-0.6056
0.7557-0.6549
0.7127-0.7015
0.6668-0.7453
0.6182-0.7861
0.5671-0.8237
0.5137-0.8580
0.4582-0.8888
0.4009-0.9161
0.3420-0.9397
0.2817-0.9595
0.2203-0.9754
0.1580-0.9874
0.0951-0.9955
0.0317-0.9995
-0.0317-0.9995
-0.0951-0.9955
-0.1580-0.9874
-0.2203-0.9754
-0.2817-0.9595
-0.3420-0.9397
-0.4009-0.9161
-0.4582-0.8888
-0.5137-0.8580
-0.5671-0.8237
-0.6182-0.7861
-0.6668-0.7453
-0.7127-0.7015
-0.7557-0.6549
-0.7958-0.6056
-0.8326-0.5539
-0.8660-0.5000
-0.8960-0.4441
-0.9224-0.3863
-0.9450-0.3271
-0.9638-0.2665
-0.9788-0.2048
-0.9898-0.1423
-0.9969-0.0792
-0.9999-0.0159
-0.99890.0476
-0.99380.1108
-0.98480.1736
-0.97180.2358
-0.95490.2969
-0.93410.3569
-0.90960.4154
-0.88150.4723
-0.84970.5272
-0.81460.5801
-0.77610.6306
-0.73460.6785
-0.69010.7237
-0.64280.7660
-0.59290.8053
-0.54060.8413
-0.48620.8738
-0.42980.9029
-0.37170.9284
-0.31200.9501
-0.25110.9679
-0.18930.9819
-0.12660.9920
-0.06340.9980
-0.00001.0000
>>B=[x;x]'
B=
00
0.06350.0635
0.12690.1269
0.19040.1904
0.25390.2539
0.31730.3173
0.38080.3808
0.44430.4443
0.50770.5077
0.57120.5712
0.63470.6347
0.69810.6981
0.76160.7616
0.82510.8251
0.88850.8885
0.95200.9520
1.01551.0155
1.07891.0789
1.14241.1424
1.20591.2059
1.26931.2693
1.33281.3328
1.39631.3963
1.45971.4597
1.52321.5232
1.58671.5867
1.65011.6501
1.71361.7136
1.77711.7771
1.84051.8405
1.90401.9040
1.96751.9675
2.03092.0309
2.09442.0944
2.15792.1579
2.22132.2213
2.28482.2848
2.34832.3483
2.41172.4117
2.47522.4752
2.53872.5387
2.60212.6021
2.66562.6656
2.72912.7291
2.79252.7925
2.85602.8560
2.91952.9195
2.98292.9829
3.04643.0464
3.10993
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- matlab 实验 报告