SHARE
TWEET

Untitled

a guest Jul 18th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. N = 600;
  2. x = 1:N;
  3.  
  4.  
  5. mean = 61;
  6. scale = 3;
  7. noisy = random('Rayleigh', scale, 1, N) + mean;
  8. drop = 0.5/100; % packet drop chance
  9. for i = x
  10.     if drop > rand()
  11.         noisy(i) = 3*noisy(i);
  12.     end
  13. end
  14.  
  15.  
  16. alpha = 0.5;
  17. b = alpha;
  18. a = [1, -(1-alpha)];
  19. filtered5= filter(b, a, noisy);
  20. alpha = 0.1;
  21. b = alpha;
  22. a = [1, -(1-alpha)];
  23. filtered1= filter(b, a, noisy);
  24. plot(x, noisy, '-b', x, filtered5, '-r', x, filtered1, '-g');
  25. legend('input', 'filter a=0.5', 'filter a=0.1')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top