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

📄 plotparams.m

📁 he AutoMix package is a C program for Unix-like systems, implementing the automatic reversible jum
💻 M
字号:
function plotParams(d, D, samples, originalSamples, S, yhat)

np = size(D,2)+1;

if d==1
   sp = '22';
   nd = 1;
   mul = 3;
elseif d==2
   sp = '23';
   nd = 2;
   mul = 6;
   ang = 5;
else
   error('unsupported dimension');
end

nc = np/mul;
if nc>1
   D(:,np) = 1-sum(D(:,mul:mul:end-1),2);
end

if nc==1, mul=mul-1; end

if d==2
   figure(nc*2+1); clf;
   
   if nargin>3
      subplot(121);
      plot(originalSamples(:,1),originalSamples(:,2),'.');
      axis('equal'); hold on;

      subplot(122);
   end

   plot(samples(:,1),samples(:,2),'.');
   axis('equal'); hold on;
   
else
   
   figure(nc+1); clf;
   [HN HX] = hist(samples,40);
   bar(HX,HN/max(HN));
   hold on;
   
end

for ki=1:nc
   figure(ki); clf;

   if d==2
      
      off = (ki-1)*mul;
      
      mI = off+1:off+2;
      eI = off+3:off+4;
      thI = off+5;

      D(:, eI) = 1./D(:, eI);      
      
   end

   for pii=1:mul
      
      ind = (ki-1)*mul+pii;
            
      subplot(strcat(sp,num2str(pii)));
      hist( D(:, ind ), 100 );
   end

   Dm = mean(D(:, (ki-1)*mul+1:(ki-1)*mul+mul));

   if d==2
      figure(nc*2+1);

      th = Dm(5);
      v = [ cos(th) sin(th) ; -sin(th) cos(th) ];
      ei = diag( Dm(3:4) );
      M = v*ei*v';
      
      if nargin>3
         subplot(122);
      end
      plot2DGaussian(Dm(1:2),M);
      text(Dm(1),Dm(2), num2str(ki));
      
      if nargin>3
         subplot(121);
         MM = S^(1/2)*M*S^(1/2);
         mm = S^(1/2)*Dm(1:2)' + yhat';
         plot2DGaussian(mm', MM);
      end
      
   else
      
      figure(nc+1);
      x = min(HX):0.1:max(HX);
      y = exp( -(x-Dm(1)).^2*Dm(2) );
      plot(x,y/max(y)*Dm(3), 'r', 'LineWidth', 2);
            
   end
end

⌨️ 快捷键说明

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