Using EZPlot to See Plot Results Quickly
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:
Open your copy of MATLAB.
You see the MATLAB application start with the Command window displayed.
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.
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.
Type hold on and press Enter.
MATLAB places a hold on the current figure.
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.
Type hold off and press Enter.
MATLAB removes the hold on the current figure.
Close your copy of MATLAB.