0001
0002
0003
0004
0005
0006 clear;
0007 disp(mfilename);
0008 help(mfilename)
0009
0010
0011 nsamples=100*3;
0012 nchans=30;
0013 ntrials=100;
0014 noise_dim=20;
0015 source=[zeros(nsamples/3,1);sin(2*pi*(1:nsamples/3)/(nsamples/3))';zeros(nsamples/3,1)];
0016 s=source*randn(1,nchans);
0017 s=repmat(s,[1,1,100]);
0018 SNR=0.1;
0019 noise=nt_mmat(randn(nsamples,noise_dim,ntrials), randn(noise_dim,nchans));
0020 data=noise/rms(noise(:))+SNR*s/nt_rms(s(:));
0021
0022
0023 c0=nt_cov(data);
0024 c1=nt_cov(mean(data,3));
0025 [todss,pwr0,pwr1]=nt_dss0(c0,c1);
0026 z=nt_mmat(data,todss);
0027
0028
0029
0030 figure(1); clf
0031 subplot 131;
0032 plot(source); title('source');
0033 subplot 132;
0034 plot(mean(data,3)); title('data');
0035 subplot 133;
0036 nt_bsplot(z(:,1,:)); title('recovered');
0037