![]() |
plotPURPOSE
Plots a Gaussian mixture.
SYNOPSIS
function h=plot(gm,varargin)
DESCRIPTION
Plots a Gaussian mixture. This function only works for Gaussian mixtures defined on one-dimensional spaces. The function accepts all the parameters applicable to Matlab lines (linestyle, color, etc). CROSS-REFERENCE INFORMATION
This function calls:
SOURCE CODE
0001 function h=plot(gm,varargin) 0002 % Plots a Gaussian mixture. 0003 % 0004 % This function only works for Gaussian mixtures defined on 0005 % one-dimensional spaces. 0006 % The function accepts all the parameters applicable to Matlab lines 0007 % (linestyle, color, etc). 0008 0009 if gm.n>0 0010 if get(gm.g{1},'dim')==1 0011 l=zeros(1,gm.n); 0012 u=zeros(1,gm.n); 0013 for i=1:gm.n 0014 c=sqrt(get(gm.g{i},'covariance')); 0015 m=get(gm.g{i},'mean'); 0016 l(i)=m-3*c; 0017 u(i)=m+3*c; 0018 end 0019 mi=min(l); 0020 ma=max(u); 0021 0022 n=100; 0023 X=mi:(ma-mi)/(n-1):ma; 0024 Y=Value(gm,X); 0025 h=line(X,Y); 0026 if nargin>1 0027 set(h,varargin{1:end}); 0028 end 0029 else 0030 error('Plot of multi-dimensional GMixtures is not implemented yet'); 0031 end 0032 end |