demo_kernel_ica.m

来自「The kernel-ica package is a Matlab progr」· M 代码 · 共 48 行

M
48
字号
% demonstration script for the kernel-ica package
fprintf('Demonstration and test of the kernel-ica package\n');
N=1000;       					%number of training samples
m=3;			  					%number of components


s=[];
for i=1:m
   switch i
   case 1, news=rand(1,N);
   case 2, news=sin((1:N)/N*20);
   case 3, news=exprnd(1,1,N);

   end
   news=news-mean(news);   % centers data
   news=news/std(news,1);  % scales data
   s=[s; news];
end

Wg=rand_orth(m);
x=Wg*s;                      % rotates data to generate mixtures


Wcca=kernel_ica(x,'contrast','kcca', ... 
   'sig',1,'kap',.01,'polish',1,'restarts',2);
sestimate=Wcca*x;

% plot results

for i=1:m
subplot(3,m,i)
plot(s(i,:))
title(sprintf('source %d',i));
axis off;

subplot(3,m,i+m)
plot(x(i,:))
title(sprintf('mixture %d',i));
axis off;

subplot(3,m,i+2*m)
plot(sestimate(i,:))
title(sprintf('estimated source %d',i));
axis off;

end

⌨️ 快捷键说明

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