Using EZPlot to See Plot Results Quickly - dummies

Using EZPlot to See Plot Results Quickly

By Jim Sizemore, John Paul Mueller

MATLAB provides the EZPlot method of working with formulas to help you easily see how the formula looks graphically without taking a lot of time to do it. With this approach, you can focus on refining the formula results rather than the associated plot. The plotting time is negligible. The disadvantage of this approach is that it lacks flexibility. Yes, you can use it to create a quick plot for a report, but if you want the best possible presentation, you need to use more sophisticated plotting techniques.

The following steps demonstrate how to use an EZPlot for a basic plotting need:

  1. Open your copy of MATLAB.

    You see the MATLAB application start with the Command window displayed.

    image0.jpg

  2. Type format compact and press Enter.

    MATLAB displays the output of anything you type using the compact format, which means without any added whitespace. Notice the use of color coding. The command is in black type; the argument is in purple. Color coding helps you understand the MATLAB input with greater ease.

    image1.jpg

  3. Type ezplot(sin(x), [-pi, pi]) and press Enter.

    The ezplot() function produces the actual plot. The sin(x) argument is the function you want ezplot() to plot. The [-pi, pi] vector contains the upper and lower limits of the plot.

    image2.jpg

  4. Type hold on and press Enter.

    MATLAB places a hold on the current figure.

    image3.jpg

  5. Type ezplot(cos(x), [-pi, pi]) and press Enter.

    You see the cos() function output added to the sin() function output because the plot has a hold placed on it.

    image4.jpg

  6. Type hold off and press Enter.

    MATLAB removes the hold on the current figure.

    image5.jpg

  7. Close your copy of MATLAB.