plotPURPOSEPlots a Gaussian.
SYNOPSISfunction h=plot(g,varargin)
DESCRIPTIONPlots 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 INFORMATIONThis function calls:
SOURCE CODE0001 function h=plot(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=Value(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 |