Advertisement
Guest User

Hafid

a guest
Sep 19th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. fs=8000;
  2. t=0:1/fs:1;
  3. x=sin(2*pi*500*t);
  4. x=x+sin(2*pi*2100*t);
  5.  
  6. bBP = [0.0201 0.0000 -0.0402 0.0000 0.0201 ]
  7. aBP = [1.0000 -2.1192 2.6952 -1.6924 0.6414 ]
  8. y=filter(bBP,aBP,x);
  9.  
  10. Ak1=abs(fft(x))/length(x);
  11. k1=0:1:length(x)-1;
  12. f1=k1*fs/length(x);
  13.  
  14. Ak2=abs(fft(y))/length(y);
  15. k2=0:1:length(y)-1;
  16. f2=k2*fs/length(y);
  17.  
  18. figure(1);
  19. subplot(2,1,1)
  20. plot(f1,Ak1)
  21. subplot(2,1,2)
  22. plot(f2,Ak2)
  23. figure(2);
  24. freqz(bBP,aBP,512,fs);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement