1 / 30

OT3OS1

OT3OS1. 20.12.2007. Metode projektovanja FIR filtara. Specifikacije za amplitudsku karakteristiku. Projektovanje primenom prozora. MATLAB Naredba FIR1 N=16; n=[0:N]'; f6dB=100; f0=1000; wn=f6dB/(f0/2); h= fir1 (N,wn); figure,stem(n,h),xlabel('n'),ylabel('h(n)');

kevina
Download Presentation

OT3OS1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. OT3OS1 20.12.2007.

  2. Metode projektovanja FIR filtara

  3. Specifikacije za amplitudsku karakteristiku

  4. Projektovanje primenom prozora MATLAB Naredba FIR1 N=16; n=[0:N]'; f6dB=100; f0=1000; wn=f6dB/(f0/2); h=fir1(N,wn); figure,stem(n,h),xlabel('n'),ylabel('h(n)'); [H,w]=freqz(h,1,1000,f0); figure,plot(w,20*log10(abs(H))),xlabel('f[Hz]'),ylabel('|H(e^j^\omega)| [dB]'); line([0 f0/2],[-6 -6],'color',[0 0 0]); line([f6dB f6dB],[-50 0],'color',[0 0 0]); z=roots(h); p=zeros(size(z)); figure,zplane(z,p);

  5. Rešenje1

  6. Rešenje2

  7. Rešenje3

  8. Uticaj prozora N=32; n=[0:N]'; fp=100; f0=1000; wn=fp/(f0/2); h1=fir1(N,wn,rectwin(N+1)); h2=fir1(N,wn,hamming(N+1)); h3=fir1(N,wn,blackman(N+1)); figure,stem(n,[h1;h2;h3]'),xlabel('n'),ylabel('h(n)'); [H1,w]=freqz(h1,1,1000,f0); [H2,w]=freqz(h2,1,1000,f0); [H3,w]=freqz(h3,1,1000,f0); figure,plot(w,20*log10([abs(H1) abs(H2) abs(H3)])), xlabel('f [Hz]'),ylabel('|H(e^j^\omega)| [dB]');

  9. Rešenje1

  10. Rešenje2

  11. Red LP filtra N1=32; N2=33; n=[0:N2]'; fp=100; f0=1000; wn=fp/(f0/2); h1=fir1(N1,wn); h1(N2+1)=0; h2=fir1(N2,wn); figure,stem(n,[h1;h2]'),xlabel('n'),ylabel('h(n)'); [H1,w]=freqz(h1,1,1000,f0); [H2,w]=freqz(h2,1,1000,f0); figure,plot(w,20*log10([abs(H1) abs(H2)])), xlabel('f [Hz]'),ylabel('|H(e^j^\omega)| [dB]'); [g1,w]=grpdelay(h1,1,1000,f0); [g2,w]=grpdelay(h2,1,1000,f0); figure,plot(w,[g1 g2]),xlabel('f [Hz]'),ylabel('gd'),ylim([15 17]);

  12. Rešenje1

  13. Rešenje2

  14. Rešenje3

  15. Red HP filtra N1=32; N2=33; fp=100; f0=1000; wn=fp/(f0/2); h1=fir1(N1,wn,'high'); h2=fir1(N2,wn,'high'); h1(length(h2))=0; n=[0:length(h2)-1]'; figure,stem(n,[h1;h2]'),xlabel('n'),ylabel('h(n)'); [H1,w]=freqz(h1,1,1000,f0); [H2,w]=freqz(h2,1,1000,f0); figure,plot(w,20*log10([abs(H1) abs(H2)])), xlabel('f [Hz]'),ylabel('|H(e^j^\omega)| [dB]'); [g1,w]=grpdelay(h1,1,1000,f0); [g2,w]=grpdelay(h2,1,1000,f0); figure,plot(w,[g1 g2]),xlabel('f [Hz]'),ylabel('gd'),ylim([15 17.5]);

  16. Rešenje1 Warning: Odd order symmetric FIR filters must have a gain of zero at the Nyquist frequency. The order is being increased by one.

  17. Rešenje2

  18. Rešenje3

  19. Projektovanje zasnovano na frekvencijskom odabiranju MATLAB Naredba FIR2 N=32;f6dB=100;f0=1000; wn=f6dB/(f0/2); h1=fir1(N,wn); h2=fir2(N,[0 wn 1],[1 0.5 0]); h3=fir2(N,[0 wn wn 1],[1 1 0 0]); n=[0:N]'; figure,stem(n,[h1;h2;h3]'),xlabel('n'),ylabel('h(n)'),; [H1,w]=freqz(h1,1,1000,f0); [H2,w]=freqz(h2,1,1000,f0); [H3,w]=freqz(h3,1,1000,f0); figure,plot(w,20*log10([abs(H1) abs(H2) abs(H3)])), xlabel('f [Hz]'),ylabel('|H(e^j^\omega)| [dB]'); z1=roots(h1);p1=zeros(size(z1)); z2=roots(h2);p2=zeros(size(z2)); z3=roots(h3);p3=zeros(size(z3)); figure,zplane([z1 z2 z3],[p1 p2 p3]);

  20. Rešenje1

  21. Rešenje2

  22. Rešenje3

  23. Optimalna aproksimacija MATLAB Naredba FIRPM N=32; fg=[0 100 200 500]; f0=1000; wg=fg/(f0/2); h1=fir2(N,wg,[1 1 0 0]); h2=firpm(N,wg,[1 1 0 0]); n=[0:N]'; figure,stem(n,[h1;h2]'),xlabel('n'),ylabel('h(n)'); [H1,w]=freqz(h1,1,1000,f0); [H2,w]=freqz(h2,1,1000,f0); figure,plot(w,20*log10([abs(H1) abs(H2)])), xlabel('f[Hz]'),ylabel('|H(e^j^\omega)|[dB]'); figure,plot(w,[abs(H1) abs(H2)]),xlabel('f[Hz]'),ylabel('|H(e^j^\omega)|'); z1=roots(h1);p1=zeros(size(z1)); z2=roots(h2);p2=zeros(size(z2)); figure,zplane([z1 z2],[p1p2]);

  24. Rešenje1

  25. Rešenje2

  26. Rešenje3

  27. Red HP filtra N1=32; N2=33; fg=[0 100 200 500]; f0=1000; wg=fg/(f0/2); h1=firpm(N1,wg,[0 0 1 1]); h2=firpm(N2,wg,[0 0 1 1]); h3=firpm(N2,wg,[0 0 1 1],'h'); n=[0:length(h2)-1]'; figure,stem(n,[h1 0 0;h2;h3 0]'),xlabel('n'),ylabel('h(n)'); [H1,w]=freqz(h1,1,1000,f0); [H2,w]=freqz(h2,1,1000,f0); [H3,w]=freqz(h3,1,1000,f0); figure,plot(w,20*log10([abs(H1) abs(H2) abs(H3)])), xlabel('f [Hz]'),ylabel('|H(e^j^\omega)| [dB]'); [g1,w]=grpdelay(h1,1,1000,f0); [g2,w]=grpdelay(h2,1,1000,f0); [g3,w]=grpdelay(h3,1,1000,f0); figure,plot(w,[g1 g2 g3]),xlabel('f [Hz]'),ylabel('gd'),ylim([15 18]),;

  28. Rešenje1 Warning: Odd order symmetric FIR filters must have a gain of zero at the Nyquist frequency. The order is being increased by one. Alternatively, you can pass a trailing 'h' argument, as in firpm(N,F,A,W,'h'), to design a type 4 linear phase filter.

  29. Rešenje2

  30. Rešenje3

More Related