matlab画2d曲线命令
来源:互联网 发布:淘宝一般包邮地区 编辑:程序博客网 时间:2024/04/19 05:32
plot -2-D line plot
Syntax
plot(Y)
plot(X1,Y1,...,Xn,Yn)
plot(X1,Y1,LineSpec,...,Xn,Yn,LineSpec)
plot(...,'PropertyName',PropertyValue,...)
plot(axes_handle,...)
h = plot(...)
Description
plot(Y) plots the columns of Y versus the index of each value when Y is a real number. For complex Y, plot(Y) is equivalent toplot(real(Y),imag(Y)).
plot(X1,Y1,...,Xn,Yn) plots each vector Yn versus vector Xn on the same axes. If one of Yn or Xn is a matrix and the other is a vector, it plots the vector versus the matrix row or column with a matching dimension to the vector. If Xn is a scalar and Yn is a vector, it plots discrete Yn points vertically at Xn. If Xn or Yn are complex, imaginary components are ignored. If Xn or Yn are matrices, they must be 2-D and the same size, and the columns of Yn are plotted against the columns of Xn. plot automatically chooses colors and line styles in the order specified by ColorOrder and LineStyleOrder properties of current axes.
plot(X1,Y1,LineSpec,...,Xn,Yn,LineSpec) plots lines defined by the Xn,Yn,LineSpec triplets, where LineSpec specifies the line type, marker symbol, and color. You can mix Xn,Yn,LineSpec triplets with Xn,Yn pairs: plot(X1,Y1,X2,Y2,LineSpec,X3,Y3).
plot(...,'PropertyName',PropertyValue,...) manipulates plot characteristics by setting lineseries properties (of lineseries graphics objects created by plot). Enter properties as one or more name-value pairs. Property name-value pairs apply to all the lines plotted. You cannot specify name-value pairs for each set of data.
plot(axes_handle,...) plots using axes with the handle axes_handle instead of the current axes (gca).
h = plot(...) returns a column vector of handles to lineseries objects, one handle per line.
Tips
Plot data can include NaN and inf values, which cause breaks in the lines drawn. For example,
plot([1:5,NaN,6:10])
Skips the sixth element and resumes line drawing at the seventh element with the Y value of 6.
Examples
Plot a sine curve.
x = -pi:.1:pi;y = sin(x);plot(x,y)
Create line plot using specific line width, marker color, and marker size.
x = -pi:pi/10:pi;y = tan(sin(x)) - sin(tan(x));plot(x,y,'--rs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','g',... 'MarkerSize',10)
Modify axis tick marks and tick labels and annotate the graph.
x = -pi:.1:pi;y = sin(x);plot(x,y)set(gca,'XTick',-pi:pi/2:pi)set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'})title('Sine Function');xlabel('Radians');ylabel('Function Value');
Add a plot title, axis labels, and annotations.
x = -pi:.1:pi;y = sin(x);p = plot(x,y)set(gca,'XTick',-pi:pi/2:pi)set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'})xlabel('-\pi \leq \Theta \leq \pi')ylabel('sin(\Theta)')title('Plot of sin(\Theta)')% \Theta appears as a Greek symbol (see String)% Annotate the point (-pi/4, sin(-pi/4))text(-pi/4,sin(-pi/4),'\leftarrow sin(-\pi\div4)',... 'HorizontalAlignment','left')% Change the line color to red and% set the line width to 2 points set(p,'Color','red','LineWidth',2)
Plot multiple line plots on the same axes.
plot(sin(x));% hold axes and all lineseries properties, such as% ColorOrder and LineStyleOrder, for the next plothold allplot(sin(x+(pi/4)));
Set line color to be always black and line style order to cycle through solid, dash-dot, dash-dash, and dotted line styles.
set(0,'DefaultAxesColorOrder',[0 0 0],... 'DefaultAxesLineStyleOrder','-|-.|--|:')plot(sin(x))hold allplot(cos(x))hold allplot(log(abs(x)))
Alternatives
To plot variables in the MATLAB workspace:
In the MATLAB workspace browser, select one or more variables.
Choose the plot type from the menu.
- matlab画2d曲线命令
- matlab画曲线
- MATLAB画ROC曲线
- Matlab画曲线
- matlab画CDF曲线
- matlab 画对比曲线
- Matlab 画log曲线
- matlab画CDF曲线
- matlab 画 曲面 曲线 直线
- matlab plotroc 画roc曲线
- 绘制曲线 Quartz 2D
- Matlab 曲线
- MATLAB 画Line _Plot 2D
- matlab 怎样画颜色渐变曲线
- matlab 画曲线图--- 自定义曲线颜色
- 如何用matlab画正态分布曲线
- Matlab-2D画图
- [贝塞尔曲线(Bezier Curves) 2d实现]
- 两台主机通过SSH通信
- JAVA 泛型
- ie bug title 锚点
- POP3 SMTP 协议分析学习笔记
- HDU Bone Collector II 背包的K优解
- matlab画2d曲线命令
- C++的自赋值问题
- 查看内存泄露
- Quartz的任务的临时启动和暂停和恢复
- 第四周实验报告(二)
- 表单下拉选框及查询下拉选框
- 九度OJ 1184 二叉树递归创建遍历
- 第四周任务三:设计一个“正整数”类
- 四种强制转换类型运算符