当前位置:网站首页>捡起MATLAB的第(5)天
捡起MATLAB的第(5)天
2022-04-23 15:54:00 【Sola_Ex】
Matlab
二维曲线绘制
plot()函数
plot(x,y) %x为横坐标,y为纵坐标
ploy(y) %序号作为横坐标,y作为纵坐标
plot(x,y,s) %s表示输出样式
常用的图形修饰命令
图形窗口分割
subplot(m,n,p) %把当前窗口分成m*n个绘图区,p代表序号
如:
subplot(2,2,1)
subplot(2,2,2)
subplot(2,2,3)
subplot(2,2,4)
线性直角坐标图
绘制命令如下:
bar(x,y,s) %条形图
stairs(x,y,s) %阶梯图
stem(x,y,s) %杆图
fill(x,y,s) %填充图
实例代码使用:
x=0:0.4:8;
y = 2*exp(-0.5*x);
subplot(2,2,1);
bar(x,y,'r');
title('bar(x,y,"red")');
axis([-2,8.1,-1,2.1]);
subplot(2,2,2);
bar(x,y,'g');
title('bar(x,y,"green")');
axis([-2,8.1,-1,2.1]);
...
对数坐标图
应用场景:
- 变量在研究范围发生了数量级的变化时
- 当自变量少许变化会引起因变量极大变化时
- 需要将曲线部分划分为展开的形式时
- 需要变换某种非线性关系为线性关系时
执行命令有:
semilogx(x,y,s) %半对数坐标,x轴为对数刻度
semilogy(x,y,s) %半对数坐标,y轴为对数刻度
loglog(x,y,s) %半对数坐标,x,y轴均为对数刻度
实例使用
x=1:1e4;
y=20*log10(x.^2-x.^3);
plot(x,y)
figure; %新建多一张图
semilogx(x,y,'r');
效果如图:
极坐标图
polar(theta,rho,s) %theta = 极坐标极角,rho=极径
实例代码:
t=0:.01:2*pi;
r1=cos(9*t);
polar(t,r1,'-m')
title('给CK的玫瑰线')
我觉得还是挺好看的哈哈哈哈!!!
版权声明
本文为[Sola_Ex]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_42312125/article/details/107479466
边栏推荐
- Fastjon2他来了,性能显著提升,还能再战十年
- One brush 312 - simple repetition set - Sword finger offer 03 Duplicate number in array (E)
- leetcode-396 旋转函数
- 提取不重复的整数
- Spark 算子之distinct使用
- Simple usage of dlopen / dlsym / dlclose
- dlopen/dlsym/dlclose的简单用法
- Go language, condition, loop, function
- s16. One click installation of containerd script based on image warehouse
- R语言中实现作图对象排列的函数总结
猜你喜欢
How important is the operation and maintenance process? I heard it can save 2 million a year?
R语言中绘制ROC曲线方法二:pROC包
matplotlib教程05---操作图像
Multi level cache usage
C language --- advanced pointer
建设星际计算网络的愿景
Ice -- source code analysis
保姆级Anaconda安装教程
Tencent offer has been taken. Don't miss the 99 algorithm high-frequency interview questions. 80% of them are lost in the algorithm
Unity shader learning
随机推荐
MySQL集群模式与应用场景
Upgrade MySQL 5.1 to 5.67
One brush 313 sword finger offer 06 Print linked list from end to end (E)
Coalesce and repartition of spark operators
Read the meaning of serial port and various level signals
Spark 算子之partitionBy
[self entertainment] construction notes week 2
How do you think the fund is REITs? Is it safe to buy the fund through the bank
Spark 算子之groupBy使用
New developments: new trends in cooperation between smartmesh and meshbox
Simple usage of dlopen / dlsym / dlclose
Spark 算子之coalesce与repartition
小程序知识点积累
Function summary of drawing object arrangement in R language
单体架构系统重新架构
多生成树MSTP的配置
一刷314-剑指 Offer 09. 用两个栈实现队列(e)
shell脚本中的DATE日期计算
js正則判斷域名或者IP的端口路徑是否正確
【开源工具分享】单片机调试助手(示波/改值/日志) - LinkScope