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

📄 adapmixdec.m

📁 最新的模式识别分类工具箱,希望对朋友们有用!
💻 M
字号:
% This uses "my" mixture decomposition software% (Vittorio)%% generate a unit circleclear;NPOINTS=50;angles = 0:(2*pi/NPOINTS):2*pi;cir=[cos(angles)  sin(angles) ];ncolors = 7;colors = ['b','r','g','k','m','c','y'];nmarks = 12;marks  = ['.','h','d','p','h','^','v','*','s','<','>','o'];serv  = 13;getServerData;inputdim=2;ncentres=2;select=[1 6];options = foptions;datos=[data(:,select)];options(14) = 5;options(1)  = 1;      % Prints out error values.options(14) = 100;      % number of iterations.mix = mgmmem( datos, options);figure(1),clf;plot(datos(:,1),datos(:,2),'.'), hold on;ncentres = mix.ncentres;for i=1:ncentres  plot(mix.centres(i,1),mix.centres(i,2),'r*');endax = axis;% plot the linesfor i=1:ncentres  C = mix.covars(:,:,i);  [V D] = eig(C);  b = -mix.centres(i,:)*V(:,1);  z=(datos - ones(size(datos,1),1)*mix.centres(i,:))';  intermediate=inv(C)*z;  for j=1:size(datos,1)    probability(i,j) = z(:,j)'*intermediate(:,j);  end  ellipsoid = V*sqrt(D)*cir + mix.centres(i,:)'*ones(1,size(cir,2));  plot(ellipsoid(1,:),ellipsoid(2,:),'r');  % axis of least error  x0 = mix.centres(i,1) - sqrt(D(1,1))*V(1,1);  y0 = mix.centres(i,2) - sqrt(D(1,1))*V(2,1);  x1 = mix.centres(i,1) + sqrt(D(1,1))*V(1,1);  y1 = mix.centres(i,2) + sqrt(D(1,1))*V(2,1);  line([x0 x1],[y0 y1]);    % axis of mos error  x0 = mix.centres(i,1) - sqrt(D(2,2))*V(1,2);  y0 = mix.centres(i,2) - sqrt(D(2,2))*V(2,2);  x1 = mix.centres(i,1) + sqrt(D(2,2))*V(1,2);  y1 = mix.centres(i,2) + sqrt(D(2,2))*V(2,2);  line([x0 x1],[y0 y1]);endaxis(ax);figure(1),orient tall;print -dpsc fig1.ps% now relabel the data[Y,labels] = min(abs(probability));figure(2),clf;for i=1:ncentres  subset = find(labels==i);  plot(datos(subset,1),datos(subset,2),[marks(floor(i/nmarks)+1) colors(mod(i,ncolors)+1)]), hold on;endxlabel(labdat(select(1),:));ylabel(labdat(select(2),:));orient tall;print -dpsc fig2.psfigure(3),clf;tobeplotted=[1 4 5 10];for j=1:length(tobeplotted);  subplot(length(tobeplotted),1,j);  for i=1:ncentres    subset = find(labels==i);    plot(time(subset),data(subset,tobeplotted(j)),[marks(floor(i/nmarks)+1) colors(mod(i,ncolors)+1)]); hold on;  end  xlabel('time');  ylabel(labdat(tobeplotted(j),:));endorient tall;print -dpsc fig3.ps;figure(4),clf;tobeplotted=[7 8 2 3];for j=1:length(tobeplotted);  subplot(length(tobeplotted),1,j);  for i=1:ncentres    subset = find(labels==i);    plot(time(subset),data(subset,tobeplotted(j)),[marks(floor(i/nmarks)+1) colors(mod(i,ncolors)+1)]); hold on;  end  xlabel('time');  ylabel(labdat(tobeplotted(j),:));endorient tall;print -dpsc fig4.psfigure(5),clf;tobeplotted=[6 16 11 12];for j=1:length(tobeplotted);  subplot(length(tobeplotted),1,j);  for i=1:ncentres    subset = find(labels==i);    plot(time(subset),data(subset,tobeplotted(j)),[marks(floor(i/nmarks)+1) ...	  colors(mod(i,ncolors)+1)]); hold on;  end  xlabel('time');  ylabel(labdat(tobeplotted(j),:));endorient tall;print -dpsc fig5.ps   

⌨️ 快捷键说明

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