Home > NoiseTools > TEST > test_nt_peaky.m

test_nt_peaky

PURPOSE ^

simulation with multichannel data

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 simulation with multichannel data

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % simulation with multichannel data
0002 
0003 %{
0004 Data are uncorrelated noise sources mixed via a random matrix.  One or
0005 more of these sources are slowly modulated.  The aim is to discover this
0006 structure and/or extract the source.
0007 %}
0008 clear
0009 close all
0010 
0011 nsamples=10000;
0012 nchannels=10;
0013 
0014 if 1
0015     x=randn(nsamples,nchannels);
0016     x=nt_normcol(nt_pca(x)); % decorrelate noise sources
0017 else
0018     x=zeros(nsamples,nchannels);
0019     freqs=100+30*(1:nchannels);
0020     for k=1:nchannels
0021         x(:,k)=sin(2*pi*freqs(k)*(1:nsamples)'/nsamples);
0022     end
0023 end
0024 
0025 % modulate
0026 SNRs=ones(nchannels,1);
0027 depths=ones(nchannels,1);
0028 for k=1:nchannels 
0029     x(:,k)=SNRs(k)*x(:,k).*(1+depths(k)*sin(2*pi*(rand+k*((1:nsamples)'/nsamples)))); 
0030 end    
0031 x0=x; % save
0032 
0033 figure(1); clf
0034 subplot 311
0035 imagescc(filter(ones(10,1),1,abs(x0))'); title('Sources')
0036 
0037 % mix
0038 x=x*randn(nchannels); 
0039 subplot 312
0040 imagescc(filter(ones(10,1),1,abs(x))'); title('Mixture')
0041 
0042 figure(2); clf
0043 subplot 211; 
0044 plot(x); title('Mixture')
0045 subplot 212;
0046 p=mean(nt_pca(x).^2);
0047 plot(p/max(p), '.-');set(gca,'yscale','log');
0048 title('PCA spectrum');
0049 xlabel('PC'); ylabel('power')
0050 
0051 
0052 %%
0053 T=100;  % Time resolution (samples)
0054 W=200;  % Effective integration time
0055 nSmooth=floor(W/T);
0056 
0057 [tocomps,score]=nt_peaky([],x,T,nSmooth);
0058 
0059 zz=nt_mmat(x,tocomps);
0060 zz=nt_normcol(zz);
0061 figure(1);
0062 subplot 313
0063 imagescc(filter(ones(100,1),1,abs(zz))'); title('all')
0064 title('Reconstruction')

Generated on Sun 24-Mar-2019 12:48:49 by m2html © 2005