MATLAB二维平面绘图

plot - 2-D line plot

    This MATLAB function creates a 2-D line plot of the data in Y versus the
    corresponding values in X.If X and Y are both vectors, then they must have equal
    length and MATLAB plots Y versus X.If X and Y are both matrices, then they must
    have equal size and MATLAB plots columns of Y versus columns of X.If one of X or
    Y is a vector and the other is a matrix, then the matrix must have dimensions
    such that one of its dimensions equals the vector length.

    plot(X,Y)
    plot(X,Y,LineSpec)
    plot(X1,Y1,...,Xn,Yn)
    plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn)
    plot(Y)
    plot(Y,LineSpec)
    plot(___,Name,Value)
    plot(axes_handle,___)
    h = plot(___)
注释:
对于X和Y,可以有以下几种参数形式
(1)X是向量(行向量或列向量),Y是向量(行向量或列向量),并且length(x)==length(y)。
(2)X,Y是M*N的矩阵,Y中的每一列元素为纵坐标,绘制N条曲线。第一条曲线我的坐标为:[x11,y11],[x12,y12],..[x1M,y1M]
(3)X是向量,Y是函数。绘制出Y=F(X)的函数图。
举例1:
x=[1,3,5,6]
y=[0.1,0.2,0.3,0.4]
plot(x,y)
举例2:
x=[1,5,9;2,4,8]
y=x
plot(x,y)
%绘制出三段曲线
第一段曲线:(1,1),(2,2)
第二段曲线:(5,5),(4,4)
第三段曲线:(8,8),(9,9)

举例3:
x=[0:pi/10:2*pi]  %[0,2*pi]间隔为pi/10的向量
y-sin(x)
plot(x,y)

添加图像标题:title('标题')

添加横坐标提示: xlabel('横坐标提示')

添加纵坐标提示: ylabel('纵坐标提示')

在坐标位置添加提示:text(x,y,'提示')  %x为横坐标,y为纵坐标

 绘制网格    grid

LineSpec用字符串来表示,例如'-.'代表点和实线,'-.*'代表实现实线,点,星号

转载于:https://www.cnblogs.com/codeDog123/p/6269638.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值