Current location - Health Preservation Learning Network - Healthy weight loss - What does the plot function of matlab mean?
What does the plot function of matlab mean?
Plot function is a two-dimensional line drawing function in matlab.

The basic calling format of drawing function is:

1, drawing (y)

When y is a vector, take the component of y as the ordinate and the element serial number as the abscissa, and connect the data points in turn with straight lines to draw a curve. If y is a real matrix, draw the curve corresponding to each column one by one.

2. Drawing (x, y)

If y and x are vectors of the same dimension, draw a connected graph with x as abscissa and y as ordinate. If x is a vector and y is a matrix with the number of rows or columns equal to the length of x, draw several connected graphs with different colors, and x is the abscissa of these curves. If x and y are isomorphic matrices, draw curves with the corresponding elements of x and y, and the number of curves is equal to the number of matrix columns.

3. Drawing (x 1, y 1, x2, y2, …)

In this format, each pair of x and y must meet the requirements in Plot (x, y), and there is no influence between different pairs. This command will draw a curve for each pair of x and y. ..

X and y in the above three formats can be expressions. Plot is a basic function to draw a one-dimensional curve, but before using this function, you must first define the X and Y coordinates of each point on the curve.

Draw a curve in the range of 0≤x≤2π.

y=2e-0.5xcos(4πx)

The process is as follows:

x = 0:pi/ 100:2 * pi; y=2*exp(-0.5*x)。 * cos(4 * pi * x);

Drawing (x, y)

The drawing function can also output multiple curves at the same time, such as:

(The specific forms of G 1, G2 and G3 transfer functions are omitted here. )

%

[y 1,T]=impulse(G 1,T);

[y2, T]= pulse (G2, t);

[y3,T]=impulse(G3,T);

%

plot(T,y 1,'-',T,y2,'-. ',T,y3,'-'); Grid open

Here'-','-.'and'-'represent lines for corresponding curves.