Advertisement
Guest User

Compare KLT and kurtosis

a guest
Jul 13th, 2010
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. global N = 2^21; # Number of samples
  2. R = 1/30; # Signal-to-noise ratio
  3. P = 5; # Number of runs
  4.  
  5. function klt( d )
  6. y = autocor(d, 511);
  7. z = toeplitz(y);
  8. [vctr,val] = eig(z);
  9. plot(val(find(val))(512:-1:480))
  10. endfunction
  11.  
  12. function r = kurt( d )
  13. global N;
  14. m = d-mean(d);
  15. for k = 1:N
  16. a(k) = m(k)^2;
  17. b(k) = a(k)^2;
  18. endfor
  19. r = ((sum(b)/N)/((sum(a)/N)^2)) - 3;
  20. endfunction
  21.  
  22. s = sinewave(N,10)*R;
  23. for k = 0:P-1
  24. n = randn(1, N);
  25. x = s + n;
  26.  
  27. subplot(P,2,2*k+1);
  28. klt(n);
  29. title(sprintf("Noise (Kurtosis: %f)",kurt(n)))
  30.  
  31. subplot(P,2,2*k+2);
  32. klt(x);
  33. title(sprintf("Signal plus noise (Kurtosis: %f)",kurt(x)))
  34. endfor
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement