Home

Using EZPlot to See Plot Results Quickly

|
|  Updated:  
2016-03-26 08:24:44
|   From The Book:  
MATLAB For Dummies
Explore Book
Buy On Amazon

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.

About This Article

This article is from the book: 

About the book author:

Jim Sizemore is Professor of Physics and Engineering at Tyler Junior College. For over 25 years he s worked in the semiconductor and software industries as a process engineer, device physicist, and software developer and has been teaching college physics, engineering, and math for the last 13 years.

John Paul Mueller is a freelance author and technical editor. He has writing in his blood, having produced 100 books and more than 600 articles to date. The topics range from networking to home security and from database management to heads-down programming. John has provided technical services to both Data Based Advisor and Coast Compute magazines.