当前位置:网站首页>matlab习题 —— 图像绘制练习
matlab习题 —— 图像绘制练习
2022-06-29 02:38:00 【繁依Fanyi】
matlab系列文章:目录

一、题目
- (1) 读取附件1
sd.xlsx,以相邻两列数据绘制散点图并标注;以第 1,2,4 列数据绘制空间散点图 - (2) 根据下面图形写出作图语句
- ① y = s i n x y=sinx y=sinx, y = c o s x y=cosx y=cosx 在同一幅图;
- ② y = s i n x y=sinx y=sinx, y = c o s x y=cosx y=cosx 在同一幅图不同窗口
- (3) 数组 [ 2 , 5 , 10 , 12 , 13 , 7 , 2 , 10 , 4 , 6 , 8 , 8 , 4 , 7 , 8 ] [2,5,10,12,13,7,2,10,4,6,8,8,4,7,8] [2,5,10,12,13,7,2,10,4,6,8,8,4,7,8] 作竖直、水平、立体柱状图、饼状图
- (4) 绘制空间曲线 x = e 0.3 t s i n t x=e^{0.3t}sint x=e0.3tsint, y = e 0.3 t c o s t y=e^{0.3t}cost y=e0.3tcost, z = e 0.3 t z=e^{0.3t} z=e0.3t, t ∈ [ 0 , 6 π ] t∈[0,6 \pi] t∈[0,6π]
- (5) 使用
mesh、surf绘制曲面 z = f ( x , y ) = s i n x 2 + y 2 x 2 + y 2 , x . y ∈ [ − 10 , 10 ] z=f(x,y)=\frac{sin{\sqrt{x^2+y^2}}}{\sqrt{x^2+y^2}},x.y\in[-10,10] z=f(x,y)=x2+y2sinx2+y2,x.y∈[−10,10] - (6) 绘制上半球面 z = 4 − x 2 − y 2 z=\sqrt{4-x^2-y^2} z=4−x2−y2 与锥面 z + 2 = x 2 + y 2 z+2=\sqrt{x^2+y^2} z+2=x2+y2 所围成的立体
- (7) 平面 z = 2 x − 3 y z=2x-3y z=2x−3y 截马鞍面 z = x 2 − 2 y 2 z=x^2-2y^2 z=x2−2y2
二、解答
>> [num1]=xlsread('F:\sd.xlsx',1,'A1:B191')
>> [num2]=xlsread('F:\sd.xlsx',1,'D1:E191')
>> [num3]=xlsread('F:\sd.xlsx',1,'G1:H40')
题一
① 读取附件1 sd.xlsx,以相邻两列数据绘制散点图并标注
>> scatter(num1(:,[1]),num1(:,[2]),[],'b','filled')
>> hold on
>> scatter(num2(:,[1]),num2(:,[2]),[],'r','filled')
>> hold on
>> scatter(num3(:,[1]),num3(:,[2]),[],'black','filled')
>> title('shu ju A B C san dian tu')
>> legend('shu ju zu A','shu ju zu B','shu ju zu C')

② 以第 1,2,4 列数据绘制空间散点图
>> scatter3(num1(:,[1]),num1(:,[2]),num2(:,[1]),'filled')

题二
① y = s i n x y=sinx y=sinx, y = c o s x y=cosx y=cosx 在同一幅图
>> x = 0:0.01:2*pi
>> y1 = sin(x)
>> y2 = cos(x)
>> plot(x,y1,x,y2)
>> title('The graph of sinx and cosx','color','b')
>> legend('y=cosx','y=sinx')

② y = s i n x y=sinx y=sinx, y = c o s x y=cosx y=cosx 在同一幅图不同窗口
>> subplot(1,2,1)
>> plot(x,y1)
>> title('y=sinx')
>> box off
>>
>> subplot(1,2,2)
>> plot(x,y2)
>> title('y=cosx')
>> box off

题三
数组 [ 2 , 5 , 10 , 12 , 13 , 7 , 2 , 10 , 4 , 6 , 8 , 8 , 4 , 7 , 8 ] [2,5,10,12,13,7,2,10,4,6,8,8,4,7,8] [2,5,10,12,13,7,2,10,4,6,8,8,4,7,8]
>> % 读数据
>> data = [2,5,10,12,13,7,2,10,4,6,8,8,4,7,8]
① 竖直柱状图
>> bar(data)

② 水平柱状图
>> barh(data)

③ 立体柱状图
>> bar3(data)

④ 饼状图
>> pie(data)

题四
① 绘制空间曲线 x = e 0.3 t s i n t x=e^{0.3t}sint x=e0.3tsint, y = e 0.3 t c o s t y=e^{0.3t}cost y=e0.3tcost, z = e 0.3 t z=e^{0.3t} z=e0.3t, t ∈ [ 0 , 6 π ] t∈[0,6 \pi] t∈[0,6π]
>> t = 0:0.01:6*pi
>> x = exp(0.3*t).*sin(t)
>> y = exp(0.3*t).*cos(t)
>> z = exp(0.3*t)
>> plot3(x,y,z)

题五
① 使用 mesh、surf 绘制曲面 z = f ( x , y ) = s i n x 2 + y 2 x 2 + y 2 , x . y ∈ [ − 10 , 10 ] z=f(x,y)=\frac{sin{\sqrt{x^2+y^2}}}{\sqrt{x^2+y^2}},x.y\in[-10,10] z=f(x,y)=x2+y2sinx2+y2,x.y∈[−10,10]
>> x = -10:0.25:10
>> y = -10:0.25:10
>> [x,y] = meshgrid(x,y)
>> R = (x.^2+y.^2).^(1/2)
>> z = sin(R)./R
>>
>> mesh(x,y,z)
>>
>>
Ⅰ、mesh 图像

Ⅱ、surf 图像

题六
① 绘制上半球面 z = 4 − x 2 − y 2 z=\sqrt{4-x^2-y^2} z=4−x2−y2 与锥面 z + 2 = x 2 + y 2 z+2=\sqrt{x^2+y^2} z+2=x2+y2 所围成的立体
>> x=-2:0.01:2;
>> y=-2:0.01:2;
>> [x,y]=meshgrid(x,y);
>> z1=real(sqrt(4-x.^2-y.^2));
>> z2=sqrt(x.^2+y.^2)-2;
>> surf(x,y,z1),shading flat
>> hold on
>> z2(z2>0)=NaN;
>> surf(x,y,z2),shading flat

题七
① 平面 z = 2 x − 3 y z=2x-3y z=2x−3y 截马鞍面 z = x 2 − 2 y 2 z=x^2-2y^2 z=x2−2y2
>> x = -20:.1:20
>> y = -20:.1:20
>> [x,y]=meshgrid(x,y)
>> z1 = 2*x-3*y
>> z2 = x.^2-2*y.^2
>> mesh(x,y,z1)
>> hold on
>> mesh(x,y,z2)


边栏推荐
- Install mysql5.7 and change the password
- Bluetooth solution | Lenz technology Amazon direct connected magic lantern solution
- Programmers whose monthly salary is less than 30K must recite the interview stereotype. I'll eat it first
- PWN攻防世界Level2
- Download and installation of MySQL
- 字符串分段组合
- Prepare for the Blue Bridge Cup - double pointer, BFS
- 对补wasm环境的一些测试
- 【無標題】
- 99乘法表
猜你喜欢

SQL training 01

sql连续登录问题

Target detection - ADAS practice

Prepare for the Blue Bridge Cup - double pointer, BFS

短视频平台常见SQL面试题,你学会了吗?

CTFHub-Web-SQL注入-整数型注入

18. `bs对象.节点名.next_sibling` 获取兄弟节点

Ctfhub web password weak password

双击事件与单击事件的那些事

Use photoshop2022 to create a wonderful gradient effect for pictures
随机推荐
After today, I look forward to the new year's eve of the year of the rabbit
【無標題】
PWN attack and defense world level2
Ctfhub web password default password
On the fact that lambda expressions cannot handle recursion
Sysbench Pressure Test Oracle (installation and use examples)
Day10 enumeration class and annotation
微信小程序自定义组件
MySQL binlog log cleanup
【网络通信学习笔记】Socket.IO的搭建和部署
[线性代数] 1.1 二阶与三阶行列式
Project R & D, what are the free brain mapping tools that are easy to use
50 lectures on practical application of R language (34) - practical application cases of curve separation (with R language code)
Is there any risk in opening an account for Dongfang fortune stock? Is it safe for Dongfang fortune to open an account
They all talk about interviews with big factories. When I interview with small factories, I invite people to drink tea?
Set set
Relations EMC, EMI, EMS
CTFHub-Web-密码口令-默认口令
Target detection - ADAS practice
sql连续登录问题