Facebook
From Chocolate Pelican, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 149
  1. a1=1;
  2. a2=0.9;
  3. a3=0.01;
  4.  
  5. N=100;
  6. fs=1;
  7. f1=5.5/N;
  8. f2=6.5/N;
  9. f3=10.5/N;
  10. freq=((0:(N-1))*fs)/(N);
  11.  
  12. t = (0:N-1) / fs;
  13.  
  14. x = a1*cos(2*pi*f1*t)+a2*cos(2*pi*f2*t)+a3*cos(2*pi*f3*t);
  15. dx1=cos(2*pi*f1*t)+0.9*cos(2*pi*f2*t)+0.01*cos(2*pi*f3*t);
  16. dx2=cos(2*pi*f1*t)+0.9*cos(2*pi*f2*t)+0.01*cos(2*pi*f3*t);
  17.  
  18.  
  19. %X = fft(x.*bartlett(length(N)));
  20. DX11=abs(fft((dx1.*rectwin(N)')));
  21. figure(1)
  22. plot(freq,20*log(abs(DX11)));
  23. title('WYKRES rectwin - 1d')
  24.  
  25. DX12=abs(fft((dx1.*bartlett(N)')));
  26. figure(2)
  27. plot(freq,20*log(abs(DX12)));
  28. title('WYKRES bartlett - 1d')
  29.  
  30.  
  31. DX13=abs(fft((dx1.*hamming(N)')));
  32. figure(3)
  33. plot(freq,20*log(abs(DX13)));
  34. title('WYKRES hamming - 1d')
  35.  
  36.  
  37. DX14=abs(fft((dx1.*hanning(N)')));
  38. figure(4)
  39. plot(freq,20*log(abs(DX14)));
  40. title('WYKRES RECTWIN - 1d')
  41.  
  42.  
  43. DX15=abs(fft((dx1.*blackman(N)')));
  44. figure(5)
  45. plot(freq,20*log(abs(DX15)));
  46. title('WYKRES blackman - 1d')
  47.