Advertisement
Guest User

Bagus

a guest
Sep 19th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. fs=8000;
  2. t=0:1/fs:0.5;
  3. x=4*cos(2*pi*400*t)+4*cos(2*pi*900*t+0.5*pi)+5*cos(2*pi*400*t+0.25*pi);
  4.  
  5. bLP =[
  6. -0.0012 -0.0025 -0.0045 -0.0068 -0.0073 -0.0030 0.0089 0.0297 0.0583 0.0907 0.1208 0.1422 0.1500 0.1422 0.1208 0.0907 0.0583 0.0297 0.0089 -0.0030 -0.0073 -0.0068 -0.0045 -0.0025 -0.0012];
  7. a =[1];
  8. y=filter(bLP,a,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(bLP,a,512,fs);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement