⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pnormal.m

📁 该工具箱是用于统计模式识别的
💻 M
字号:
function pnormal(MI,SIGMA,I,afill,r,col)%  pnormal(MI,SIGMA,I,afill,r,col)%% PNORAML vizualizes mixture of normal distributions in 2D space. %  Each normal distribution is determined by a pair of mean values and %  covariance matrix. The mean value is vizualized as a point and the %  covariance matrix as en ellipse. %% Input:%   MI [NxM] mean values for each class, MI=[mi_1,mi_2,...,mi_M]%   SIGMA [Nx(MxN)] covariance matrices for each class,%      SIGMA=[sigma_1,sigma_2,...,sigma_M].%   I [1xK] contains class labels each pair.%   afill [1x1] if is 1 then the ellipses will be filled otherwise%      (default) will be outlined.%   r [1x1] is a radius of the ellipses.%% See also PPOINTS, PNMIX.%% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz% Written Vojtech Franc (diploma thesis) 10.11.1999, 23.12.1999% Modifications:% 23-mar-2001, V. Franc, writtenhold on;if nargin < 3 | isempty(I),  I=ones(1,size(MI,2));endif nargin < 4 | isempty(afill),  afill = 0;end  DIM=size(MI,1);K=size(MI,2);if nargin < 5 | isempty(r),  % determine appropriate radius for each ellipsoid so that they  % do not overlap each other.    r=inf*ones(1,K);   for i=1:K,    A=MI(:,i);    isigma=inv(SIGMA(:,(i-1)*DIM+1:i*DIM));        for j=1:K,      if i~=j,        B=MI(:,j);         x=A+0.5*(B-A);               rcurr=sqrt( (x-A)'*isigma*(x-A));         if rcurr < r(i),           r(i)=rcurr;         end      end    end  end  r=r*0.70;  else  if length(r) ~= K,    r=r*ones(1,K);  endendfor i=1:K,  [x,y]=ellips(MI(:,i),SIGMA(:,(i-1)*DIM+1:DIM*i),r(i),30);  if afill == 1,    if nargin < 6, col = color(I(i)); end    fill(x,y,col );    plot(MI(1,i),MI(2,i),'xk');  else    if nargin < 6, col = color(I(i)); end    plot(x,y,col);    plot(MI(1,i),MI(2,i),sprintf('x%c',col ));  end  end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -