Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.57 KB | None | 0 0
  1. clc;
  2. clear all;
  3.  
  4. x=ones(1,8);
  5. windowSize = 5;
  6. h=(1/windowSize)*ones(1,windowSize);
  7. a=1;
  8.  
  9. y=filter(h,a,x);
  10. figure;
  11. stem(x, '--b');
  12. hold on;
  13. stem(y, '--r');
  14. grid;
  15. xlabel('n')
  16. title('Signal x filtered through h')
  17. legend( 'Signal x' ,'Filtered Signal y');
  18.  
  19. z=filter(h,a,y);
  20. figure;
  21. stem(x, '--b');
  22. hold on;
  23. stem(z, '--g');
  24. grid;
  25. xlabel('n')
  26. title('Signal y filtered through h')
  27. legend( 'Signal y' ,'Filtered Signal z');
  28.  
  29. w=filter(h,a,z);
  30. figure;
  31. stem(x, '--b');
  32. hold on;
  33. stem(w, '--k');
  34. grid;
  35. xlabel('n')
  36. title('Signal z filtered through h')
  37. legend( 'Signal z' ,'Filtered Signal w');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement