Skip to content Accesskey=4Skip to sub-navigation Accesskey=3View our Accessibility Options MIT Information Systems Home About IS&T Contact IS&T Site Map Search Advanced Search
Getting StartedGetting Services by Topic or Alphabetically Getting Help

On This Page

[Help]

  

Quick Links

Top Level

Related Links

Ask OLC a question

Athena Consulting Homepage

Helpdesk Stock Answers (for Mac/PC questions)


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. 

MIT Home | Getting Started | Getting Services | Getting Help | About IS&T | Accessibility
Ask a technology question or send a comment about this web page.