plot () function summary

plot () function summary

Input:

Input parameters are matrix plot function;

  • vector x n x 1; y: have the same dimensions and a x, such as mxn.
    • The number of images is m; x is the abscissa; for each row element y ordinate;
  • x, y is the matrix with dimension: mxnX corresponds to a column of elements - the abscissa; the corresponding list of elements Y - ordinate;
  • plot (x): If x is MXN;
    • Solid matrix: for the n-number of the image; ordinal number as abscissa; the value of the ordinate corresponding to each column
    • Complex matrix: for the n-number of the image; abscissa is the real part of the element; the imaginary part of the element ordinate

Example Program

t = (0: pi/50 :2*pi)''	% t为101x1维矩阵;
k = 0.4:0.1:1			% k为1x7维矩阵;
y = cos(t)*k			% y为101x7维矩阵;

plot(y)		
% 输入3;以下标1-101为横坐标;对应的值为纵坐标;画出七条图像

plot(t, y)	
% 输入1;t和y公共的为101;故以t的值为横坐标;y中以对应的每一列为纵坐标;共画出7条图像;

image

  • plot(y)

plot () _ 1.jpg

  • plot(t, y)

plot () _ 2.jpg

Image style options

  • b-. He represents the blue dotted line
  • y:d Yellow dotted line represents, marked by diamonds and data points;
  • default Line - solid line; Color - sequentially according to the order of the curve is provided;
  • Setting method:plot( x1, y1, 选项1, x2, y2, 选项2.... )

Graphing having two longitudinal coordinates;

  • plotyy( x1, y1, x2, y2 ): To the left and right longitudinal draw two different curves;
  • plotyy( x1, y1, x2, y2, fun1, fun2 ): Longitudinal draw two different right and left curves, curves are determined by the form fun1, fun2;
    • x1, y1 corresponding to a curve (left ordinate)
    • x2, y2 corresponding to a curve (right ordinate)

For example

plotyy( x, y1, x, y2, 'semilogy', 'plot' )

plot () _ 3.jpg

The left is logarithmic; the right is the Cartesian coordinates;

Other commands

  • hold on: Keep the original layer (as a background)
  • hold off: Refresh the original layer
    • If two plot functions; the default is to retain the last one; so this time hold on command can be helpful;
  • fplotFunction, ezplotfunction;
fplot(@(x)(x.^2.*sin(x.^2-x-2)),[-2,2]);
ezplot('x.^2.*sin(x.^2-x-2)',[-2,2]);
% ezplot更适合做隐函数相关的操作;

In Matlab plot, fplot, ezplot to use and differences

Introduction to ezplot function

Introduction fplot function

Guess you like

Origin www.cnblogs.com/rongyupan/p/12662508.html