How to Reset the Hold on MATLAB

How to Reset the Hold on MATLAB thumbnail
Use the "hold" function to plot multiple graphs in the same figure.

MATLAB is a software environment that allows you to create professional-quality technical figures as well as simulation and analysis. By default, each new graphing command renders into a new figure window, but this does not allow you to plot multiple curves on a single graph. Use the “hold” function in MATLAB to plot multiple curves in a single figure window.

Instructions

    • 1

      Create a new figure by executing the "figure()" command.

    • 2

      Plot the data from your first curve using the "plot()" command for 2-D line plots.

      plot(x,y1,'--b')

      The "--b" parameter creates a line plot with no point markers in the color blue.

    • 3

      Execute the command "hold on" to direct subsequent plotting command to the same figure.

    • 4

      Plot a second set of data using a plot() or other graphing command. For example, to plot a second set of data in red:

      plot(x,y2,'--r')

    • 5

      Turn the hold function off by executing the command "hold off."

Related Searches:

References

  • Photo Credit BananaStock/BananaStock/Getty Images

Comments

Related Ads

Featured