Files
notes_estom/Matlab/教程/MATLAB8.md
yinkanglong_lab 30f583d779 项目经历整理
2021-04-06 23:30:37 +08:00

52 lines
2.5 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# MATLAB二维底层绘图的修饰
## > 对象和句柄
> *似乎MATLAB也能满足面向对象编程的一些条件诶
> MATLAB也能实现GUI图形用户界面编程同强大的C++、Java有一拼*
***
* **对象和句柄的概念**
1. MATLAB吧构成图形的各个基本要素成为图形对象产生每一个图形对象时MATLAB会自动分配一个唯一的值用于表示这个对象成为句柄好像子对象和指向对象的指针
* **对象间的基本关系**
1. 计算机屏幕->图形窗口->(用户菜单,用户控件,坐标轴)
2. 坐标轴->(曲线,曲面,文字,图像,光源,区域,方框)
## > 基本地城绘图函数
***
* **line对象**
1. ` h = line([-pi:0.01:pi],sin([-pi:0.01:pi]));`
2. 其中h成为line曲线对象的句柄。
3. line对象的修饰
* color属性
* LineWidth属性
* LineStyle属性
* Marker属性
* MarkerSize属性
4. plot函数能够产生line对象然后继续对返回的句柄进行操作、或者直接在绘制过程进行修饰。
5. ``` h1 = line('XData',[-pi:0.01:pi],'YData',sin([-pi:0.01:pi]),'LineWidth',1,'LineStyle',':','Color','r'); ```
6.
* **set底层对象的属性设置函数**
1. 可以通过生成的句柄对MATLAB中生成的操作对象进行。使用set函数进行设定。` set(h1,'LineWidth',2,'Marker','p','MarkSize','15') `
2. line对象常见的性质XData,YData,ZData,Color(y,m,c,r,g,b,w,k),DisplayName(legend ()),LineStyle(-,--,:,-.,none),LineWidth,Marker(+,o,*,.,X,s,d,'^',V,>,<,p,h,none)。MarkerEdgeColor,MarkerFaceColor,MarkerSize,Type。
* **text对象底层标注函数**
1. text是一个line的子对象可以使用text函数进行操作。
2. ht = text(0,4,'string')
3. text对象相关的属性ColorFontSizeStringRotation。
* **axes对象底层坐标轴函数**
1. axes是一个line/figure的对象可以使用axes函数进行操作
2. ``` hf = figure;
ha = axes('Parent',hf,'Position','Units','Pixels',[10,10,10,100]);```
3. 常见属性Box,GridLineStyle,Position,Units,XLabel,Ylabel,ZLabel,Xlim,Ylim,Zlim相关属性。
> 补充一点对MATLAB的认识
> MATLAB是矩阵实验室Matrix Laboratory之意。其主要提供了以下几种功能
> 1. 数值计算
> 2. 符号计算
> 3. 文字处理
> 4. 可视化建模仿真(图形功能强大)
> 5. 实时控制等功能(自动控制理论应用)
> MATLAB除了内部函数主包还有三十多种工具包用于不同领域不同需求的功能拓展。