Access Keys:
Skip to content (Access Key - 0)

An overview of MATLAB plotting

Following is an overview of plotting facilities in Matlab:

X-Y plots
----------------------------------------------------
  plot		Simple x-y plot
  semilogx      Semilog plot, logarithmic x axis
  semilogy	Semilog plot, logarithmic y axis
  loglog	Full log plot, both x and y axis logarithmic
----------------------------------------------------

Histograms
----------------------------------------------------
  hist          Histogram plot
----------------------------------------------------

R-Theta (polar) plots
----------------------------------------------------
  polar         polar plot
----------------------------------------------------

3-D plots
----------------------------------------------------
  mesh		Surface plot
  contour	Contour plot
  quiver	Vector field plot (matrix of arrows)
----------------------------------------------------

X-Y plot with curve fitting
----------------------------------------------------
  curvefitp	Plot x,y data points and fit an nth
		  order polynomial through them.  This is a home-grown
		  consultant-written function, not a function supplied
		  by the vendor.
  curvefitnl	Plot x,y data points and fit an arbitrary
		  function to the data.
----------------------------------------------------

X-Y splines
----------------------------------------------------
  spline	Cubic splines can be used to draw smooth
	 	  curves through data points. 

	   ====================================================

Each of these has a help blurb which can be seen by typing at the matlab
prompt:

	>> help plot      % or semilogx, semilogy, etc..

A good way to see how to use each of these plotting routines is to look at
the plotting demo by typing:

	>> demo

and select "Visualization" (under MATLAB)

	    --------------------------------------------------

Example: To plot sin(5*x)*exp(-x^2), for [0<x<10]

	>> x=0:.1:10

	>> y=sin(5*x).*exp(-x.^2)

	>> plot(x,y)

or, to plot with a dashed line,

	>> plot(x,y,'--') 

or, to show only the data points with no lines,

	>> plot(x,y,'*')

	     ------------------------------------------------

Example: To plot sin(x)*cos(y), for [-4<x<4] [-4<y<4]

        >>  [X,Y]=meshgrid(-4:.2:4,-4:.2:4);

	>>  mesh(sin(X).*cos(Y))
or,
	>>  contour(sin(X).*cos(Y))

	     ================================================
		     Miscellaneous plotting functions
	     ------------------------------------------------

  bode		Draw a Bode plot given a transfer function.

  step		Plot the step response of a continuous-time linear system.

For other specialized plots and animation functions, consult the
"Using Matlab Graphics" PDF manual, by typing "helpdesk" at the >>
prompt. 

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

December 15, 2010

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
c-matlab c-matlab Delete
matlab matlab Delete
plotting plotting Delete
plot plot Delete
matlab-review matlab-review Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki