Plotting Analysis Objects


The data in an AO can be plotted using two different functions.

  1. A simple plot function plot
  2. An intelligent plotting function iplot

AO plot method

There are various calls to the simple plot method:

		>> plot(a1)
	

Plots the data contained in the AO (a1) into the currently active axes.

As with the standard MATLAB plot function, you can pass line specifications to ao/plot. For example,

		>> plot(a1, 'LineStyle', '--')
	

Plots the data contained in the AO (a1) into the currently active axes with a dashed line.

See help plot for further line specifications.

		>> plot(axh, a1)
	

Plots the data contained in the AO (a1) into the axes specified by the given handle, axh.

You can get handles to the various plot elements as follows:

		>> line_h                     = plot(a1)  % returns a handle to the line objects
		>> [line_h, axes_h]           = plot(a1)  % returns a handle to the line and axes objects
		>> [line_h, axes_h, figure_h] = plot(a1)  % returns a handle to the line, axes and figure objects
	

AO iplot method

The iplot method provides a more advanced plotting interface for AOs which tries to make good use of all the information contained within the input AOs. For example, if the xunits and yunits fields of the input AOs are set, these labels are used on the plot labels.

In addition, iplot can be configured using a input plist. The following examples show some of the possible ways to use iplot

		>> a1 = ao(plist('tsfcn', 'sin(2*pi*0.3*t) + randn(size(t))', 'fs', 10, 'nsecs', 20))
		----------- ao: a1 -----------

		       name:  TSfcn
		 provenance:  created by hewitson@bobmac-2.local[172.16.251.1] on MACI/7.6 (R2008a Prerelease)/0.99 (R2008a Prerelease) at 2008-02-29 18:54:12.127
		description:
		       data:  tsdata / sin(2*pi*0.3*t) + randn(size(t)) [200x1] | (0,-2.00888) (0.1,-1.02877) (0.2,-1.02874) (0.3,-1.13014) (0.4,0.883107) ...
		       hist:  history / ao / $Id: ao.m,v 1.89 2008/03/07 10:02:29 ingo Exp
		  mfilename:
		mdlfilename:
		------------------------------

		>> a1.data
		-------- tsdata 01 ------------

		  name:  sin(2*pi*0.3*t) + randn(size(t))
		    fs:  10
		     x:  [200 1], double
		     y:  [200 1], double
		xunits:  s
		yunits:  V
		 nsecs:  20
		    t0:  1970-01-01 00:00:00.000
		-------------------------------
	

Creates a time-series AO. If we look at the data object contained in this AO, we see that the xunits and yunits are set to the defaults of seconds [s] and Volts [V].

If we plot this object with iplot we see these units reflected in the x and y axis labels.

		>> iplot(a1)
	
AO iplot eg1

We also see that the time-origin of the data (t0 field of the tsdata class) is displayed as the plot title.




©LTP Team