The subplot command creates several plots in a single window. To be precise, subplot(m,n,i) creates mn plots, arranged in an array with m rows and n columns. It also sets the next plot command to go to the ith coordinate system (counting across the rows). Here is an example (see Figure 7):
>> t = (0:.1:2*pi)'; >> subplot(2,2,1) >> plot(t,sin(t)) >> subplot(2,2,2) >> plot(t,cos(t)) >> subplot(2,2,3) >> plot(t,exp(t)) >> subplot(2,2,4) >> plot(t,1./(1+t.^2))
Figure 7: Using the subplot command