%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all;
close all;
clc;
tic
m=100;
n=200;
true_s=zeros(n,1);
dd=randperm(n);
r=n/10;
non_zero_idx=dd(1:r)';
fffff=rand(1,r);
true_s(dd(1:r))=fffff;
true_s=true_s/norm(true_s);
S=true_s;
% m=1024; %number of mixtures
% n=4096; %number of sources
% k=1;
% std_noise=0.01; %standard deviation of inactive sources
% std_source=1; %standard deviation of active sources
% np=nchoosek(n,k); %total number of concetration subspaces
T=1; %length of the sources
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%generating the mixing matrix
A=randn(m,n);
for j=1:n
A(:,j)=A(:,j)./norm(A(:,j));
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%generating the sources
% p=2.1;
% z=randn(n,T);
count=0;
%S= sign(z).*(abs(z)>p)+(abs(z)<=p).*(randn(n,T)*std_noise);
% S= sign(z).*(abs(z)>p)
for i=1:n
if abs(S(i))>0.8
count=count+ 1; %the number of nonzero entries.
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%generating the mixture matrix
X=A*S;
%%%%%%%%%%%%%%%%%%Focuss 分离方法
recover = focuss(X,A,T,m,n);
%%%%%%%%%%%%%%%%PLOT
% subplot(2,1,1)
plot(S(1:n),'r.');
hold on
% subplot(2,1,2)
plot(recover(1:n),'bo');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dB
for i=1:n
comp(i) =( S(i)-recover(i) ) ;
end
db =-20*log10( norm(comp)/norm(recover));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SS = focuss(X,A,T,m,n);
% for i=1:n
% comp(i) =( S(i)-SS(i) ) ;
% end
% db =-20*log10( norm(comp)/norm(SS));
% toc
% subplot(2,1,1)
% plot(S(1:n),'r');
% subplot(2,1,2)
% plot(SS(1:n),'r');
%
%
- 1
- 2
- 3
前往页