Institut de Robòtica i Informàtica Industrial

PlotGaussian

PURPOSE ^

Plots a Gaussian.

SYNOPSIS ^

function h=PlotGaussian(G,varargin)

DESCRIPTION ^

 Plots a Gaussian.

 Plots a Gaussian. For one-dimensinal Gaussians produces a
 one-dimensional plot. For higher dimensional Gaussians an ellipse
 representing the marginal of the Gaussian on the two first dimensions is
 shown.
 The fuction accepts an optional parameter with the color for the plot.

 Returns:
    h: The handler of the line/ellipse representing the Gaussian.

CROSS-REFERENCE INFORMATION ^

This function calls:
  • get Get function for robots.
  • get Get function for trajectories.
  • get Get function for EKF filters.
  • get Generic get function for filters.
  • get Get function for TRO filters.
  • get Get function for BTrees.
  • get Get function for PoseData objects.
  • set Set functino for PoseData objects.
  • GaussianValue Evaluates a Gaussian in an array of points
  • get Get function for Gaussians.
  • sqrt Element-wise square root of an interval matrix (operator: .^0.5).
  • get Get function for poses.
  • get Generic get for relative positioning sensors
  • get Generic get for sensors
This function is called by:

SOURCE CODE ^

0001 function h=PlotGaussian(G,varargin)
0002 % Plots a Gaussian.
0003 %
0004 % Plots a Gaussian. For one-dimensinal Gaussians produces a
0005 % one-dimensional plot. For higher dimensional Gaussians an ellipse
0006 % representing the marginal of the Gaussian on the two first dimensions is
0007 % shown.
0008 % The fuction accepts an optional parameter with the color for the plot.
0009 %
0010 % Returns:
0011 %    h: The handler of the line/ellipse representing the Gaussian.
0012 
0013   if G.d==0
0014     h=0;
0015   else
0016     if G.dim==1
0017       r=3*sqrt(G.S); % represent the Gaussian from -3*sigma to 3*sigma
0018       n=100; %points of the curbe representing the gaussain
0019       
0020       X=(-r:(2*r)/(n-1):r)+G.m;
0021       Y=GaussianValue(G,X);
0022       
0023       plot(X,Y);
0024     else
0025       h=line([G.m(1) G.m(1)],[G.m(2) G.m(2)]);
0026       set(h, 'marker','*');
0027       if nargin>1
0028         set(h, 'Color',varargin{1});
0029       end
0030       el=get(G,'ellipse');
0031       h = line(el(1,:),el(2,:));
0032       
0033       if nargin>1
0034         set(h, 'Color',varargin{1});
0035       end
0036     end
0037   end


Institut de Robòtica i Informàtica Industrial

Generated on Fri 24-Jul-2009 12:32:50 by m2html © 2003