Graphics Programs Reference
In-Depth Information
figures in one window, or of producing animated graphics that change with
time.
Combining Figures in One Window
The command subplot divides the figure window into an array of smaller
figures. The first two arguments give the dimensions of the array of sub-
plots, and the last argument gives the number of the subplot (counting left
to right across the first row, then left to right across the next row, and so on)
in which to put the next figure. The following example, whose output appears
as Figure 5-8, produces a 2 × 2 array of plots of the first four Bessel functions
J n ,0 n 3:
>> x = 0:0.05:40;
>> for j = 1:4, subplot(2,2,j)
plot(x, besselj(j*ones(size(x)), x))
end
1
0.6
0.4
0.5
0.2
0
0
-0.2
-0.5
-0.4
0
10
20
30
40
0
10
20
30
40
0.6
0.6
0.4
0.4
0.2
0.2
0
0
-0.2
-0.2
-0.4
-0.4
0
10
20
30
40
0
10
20
30
40
Figure5-8
Search WWH ::




Custom Search