Subgraph
Sub figure is more than one image to be displayed on a picture, draw subgraph command subplot(m,n,p)
command, here m,n
to tell MATLAB
subgraph generated have m
rows n
columns, p
tell MATLAB
a graphic window has drawn us to be posted up.
The first example we show side by side the two functions:
in both cases, we are located x
in 0~5
between, y
in -1~1
between, we first define domain-defined function, and then call the functionsubplot
>> x = [0:0.01:5];
>> y1 = exp(-1.2*x).*sin(20*x);
>> subplot(1,2,1)
Pass subplot
us (1,2,1), telling MATLAB
us that we will create an image with one row and two columns, and the next drawing will be displayed in the first pane, but no image has been drawn yet:
now we call the plot
command :
Looking at the picture now, the image of the function has been drawn in the first pane.
Next we create a second image, first we define the function:
>> y2 = exp(-2*x).*sin(20*x);
Now we call subplot
, this time tell MATLAB
us that we will draw the graph on the second pane:
at this time, we MATLAB
have not put anything on it, at this time we want to call the plot
command:
>> plot(x,y2),xlabel('x'),ylabel('exp(-2x)*sin(20x)'),axis([0 5 -1 1])
image: