当前位置:网站首页>Matlab绘制曲线
Matlab绘制曲线
2022-06-10 09:53:00 【盛世如恋】
绘制曲线
plot(x,y):x和y为长度相同的向量,分别用于存储x坐标和y坐标
plot(x1,y1,选项1,x2,y2,选项2...):多组折线
plot3(x1,y1,z1,选项1,xn,yn,zn,选项n) :空间曲线
fplot('fun',[a,b]):绘制fun函数在区间[a,b]上的图形,fun可以是函数或表达式
%上述的选项可以是
% 线型 -实线 :虚线 -.点划线 --划线
% 点标记 .点 o圈 x叉 +加号 *星号 s方形 d菱形
% ^朝上三角 v朝下 >朝右 <朝左三角 p五角形 h六角形
% 颜色 b蓝色(默认) m棕色 c青色 r红色 g绿色 y黄色 w白色 k黑色
%实例
x = 0:pi/100:2pi;
y = 2exp(-0.5x).sin(2pix);
plot(x,y,‘ro’); %其中’r*'就是上述的选项
2exp(-0.5x)sin(2pix),[0,2pi],‘gd’);
%三维作图
t =0:pi/50:2pi;
x = 8cos(t); y = 4*sqrt(2)sin(t);
z = -4sqrt(2)*sin(t);
plot3(x,y,z,‘sk’);
%曲面图形
%平面网格坐标的生成
x =a:dx:b;
y = c:dy:d;
[X,Y] = meshgrid(x,y);
%绘制三维曲面的函数
% mesh(x,y,z): 网格图;
% surf(x,y,z) : 曲面图(填充网格);
% contour(x,y,z): 等高线图(平面图);
% contour3(x,y,z):三维等高线图(空间图);
%实例
figure
xa=-2:0.2:2; ya = xa;
[x,y]=meshgrid(xa,ya);
z = x.*exp(-x.2-y.2);
mesh(x,y,z) ; pause(2); %网格图
surf(x,y,z) ; pause(2); %填充网格
contour(x,y,z) ; pause %平面等高线
contour3(x,y,z) ; pause %立体等高线
contour(x,y,z,[-0.1 0.1]);
surf(x,y,z);
%图形窗口的分割subplot(m,n,p)
hold off %释放当前图形窗口的图形
x = linspace(0,2pi,60);
y = sin(x);
z = cos(x);
subplot(2,2,1); %2行x2列中的1号区
plot(x,y); title(‘sin(x)’); axis([0,2pi,-1,1]);
subplot(2,1,2); %2行1列中的二号区
plot(x,z,''); title(‘cos(x)’); axis([0,2*pi,-1,1]);
x = linspace(-2,2,60);
y = x.^3;
subplot(2,2,2); %2行x2列中的2号区
plot(x,y); title(‘x^3’); axis([-2,2,-4,4]);
%图形标注
% title(图形名称) xlabel(x轴说明) ylabel(y轴说明)
%循环语句
hold on /off %保留/释放现有图形
figure / close %新开/关闭图形窗口
grid on /off % 画/不画网格线 ,不带参数的grif命令在两种状态之间进行切换
axis on /off % 显示/取消坐标轴
axis([xmin xmax ymin ymax zmin zmax]) %限定坐标轴的范围
边栏推荐
- 你的下一台电脑何必是电脑,探索不一样的远程操作
- MONGOREPLAY 的“坑”
- 2022年普通脚手架工(建筑特殊工种)操作证考试题库及模拟考试
- Neo 黑客松获奖名单揭晓,上万美金花落谁家?
- osg基本操作
- [FAQ] summary of common problems and solutions during the use of rest API interface of sports health service
- Mongodb publishes "queryable encryption" system
- 致广大、尽精微,曙光问道算力服务“神经系统”
- 01 backpack problem
- Lambda表达式例二
猜你喜欢
![[edge detection] eight direction Sobel image edge detection based on MATLAB [including Matlab source code 1865]](/img/c8/039e7fc983905ae74e2d945dc6fbea.jpg)
[edge detection] eight direction Sobel image edge detection based on MATLAB [including Matlab source code 1865]

Réflexions sur la conception de la gestion du réseau Unicom 5g

Uncaught TypeError: Cannot read properties of undefined (reading ‘colspan‘)

Bing's website search site: < domain name>< search content>

5g Unicom network management design idea

How to send asynchronous requests gracefully in wechat applets?

SAP 云平台多目标应用 Multi-Target Application 的开发技术介绍

【730. 统计不同回文子序列】

5G 联通网管设计思路

Radiolisttile is displayed in row of the shutter
随机推荐
收藏 | VLOOKUP函数的这些妙用你都知道吗?
"Pit" of mongoreplay
【边缘检测】基于matlab八方向sobel图像边缘检测【含Matlab源码 1865期】
June training (day 10) - bit operation
Shutter: custom radio button
Basic process of program compilation
[FAQ] summary of common problems and solutions during the use of rest API interface of sports health service
Requirements and business model analysis - Requirements 17- requirements management
Genius! Only use four integers to write a snake game!
2022年金属非金属矿山提升机操作考试题库及答案
axure添加下拉菜单联动
2022年煤矿井下电气考试题库及在线模拟考试
NFT铸造交易平台开发市场详情
How to handle art record? What materials should be prepared for handling the art record?
Use nsenter to enter netns to capture packets
Lambda表达式例二
2022年金属非金属矿山提升机操作考试题库及答案
张小白教你使用OGG实现Oracle 19C到MySQL 5.7的数据同步(1)
2022年普通脚手架工(建筑特殊工种)操作证考试题库及模拟考试
Personnalisation de l'équipement d'essai de Chengdu Introduction préliminaire aux types de données du langage C du micro - ordinateur à puce unique