Worcester Polytechnic Institute

Subplot Function

Home

Google

Online Materials

Contact Us

Site Map

 

Using the subplot(rows, cols, plot_num) command we can display multiple plots in the same figure window.  This description is in the quick reference.  Let’s put the two cosine functions together to see their differences. 

 

 

 


         

 

         

          subplot(2,1,1);

          plot(t, cos(t));

          title(‘Cos(t)’);

          subplot(2,1,2);

          plot(t, cos(50*t));

          title(‘Cos(50*t)’);

 

 

 

 

 

 

 

 

As you can see the multiplication of 50 in the cosine function has increased the period, reducing the frequency.  Now we have a background in basic functions and plotting commands. 

 

Return to Matlab Tutorial.

 

[WPI]