MATLAB Plot Function Guide
The plot function in MATLAB is used to draw 2D graphs. The basic syntax is:
plot(x, y)
In this case, x and y represent vectors or matrices for the horizontal and vertical coordinates respectively. Multiple data sets can be plotted on the same graph, and properties such as line type and color can be adjusted. For example:
x = 0:0.1:10;
y1 = sin(x);
y2 = cos(x);
plot(x, y1, 'r--', x, y2, 'b-')
The code above will plot the graphs of sin(x) and cos(x), where sin(x) is represented by a red dashed line and cos(x) by a blue solid line.
After drawing the chart, you can use functions like xlabel, ylabel, and title to add axis labels and a title.