1
0

laplace.m 412 B

123456789101112131415161718192021222324252627
  1. % Generation of Laplacian random i.i.d. processes
  2. %
  3. % Inputs
  4. % N : number of sources
  5. % T : number of samples
  6. % Outputs
  7. % s : source vector
  8. function s=laplace(N,T);
  9. TAU=1;
  10. s0=rand(N,T);
  11. r1=(s0<=0.5).*(log(2*s0)/TAU);
  12. r2=(s0>0.5).*(-log(2-2*s0)/TAU);
  13. s=r1+r2;
  14. s=cnorm(s);
  15. function s=cnorm(e)
  16. for k=1:size(e,1);
  17. s(k,:)=e(k,:)-mean(e(k,:));
  18. s(k,:)=s(k,:)./mean(s(k,:).^2)^0.5;
  19. end