1 / 14

Matlab 之 FIR 濾波器設計與實現

Matlab 之 FIR 濾波器設計與實現. 老師 : 趙春棠 學生 : 林奉機. OUTLINE. 窗函數法 ( Kaiser window ) 等波紋法 ( remez ) 比較 結果分析. 窗函數法. 為了去除 FIR 濾波器在通帶與拒帶的頻率響應震盪 ﹐ 有必要把不要的部份予以截除 (Truncate)﹐ 而保留需要的部份 ﹐ 使用的方法簡單的說就是把希望的響應與一個適當的窗形函數進行環形摺積 ﹐ 使得處理後的響應能夠滿足規格要求 環形摺積 對於一個希望得到的 (Desired) 濾波器頻率響應 ﹐ 其具有在通帶時為線性相位 ﹐

cortez
Download Presentation

Matlab 之 FIR 濾波器設計與實現

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. Matlab之FIR濾波器設計與實現 老師:趙春棠 學生:林奉機

  2. OUTLINE 窗函數法(Kaiser window) 等波紋法(remez) 比較 結果分析 Robot and Servo Drive Lab.

  3. 窗函數法 • 為了去除FIR濾波器在通帶與拒帶的頻率響應震盪﹐有必要把不要的部份予以截除(Truncate)﹐而保留需要的部份﹐使用的方法簡單的說就是把希望的響應與一個適當的窗形函數進行環形摺積﹐使得處理後的響應能夠滿足規格要求 • 環形摺積 對於一個希望得到的 (Desired)濾波器頻率響應﹐ 其具有在通帶時為線性相位﹐ 在拒帶則完全阻絕信號通過 Robot and Servo Drive Lab.

  4. f p:Ω p1=0.45pi,Ω p2=0.65pi,α p:δ 1<=1[dB]。f st:Ω s1=0.3pi,Ω s2=0.8pi,δ p:f p:Ω p1=0.45pi,Ω p2=0.65pi,α p:δ 1<=1[dB]。f st:Ω s1=0.3pi,Ω s2=0.8pi,δ p: δ 2>=40[dB] [n,wn,bta,ftype]=kaiserord([0.3 0.45 0.65 0.8],[0 1 0],[0.01 0.1087 0.01]); h1=fir1(n,wn,ftype,kaiser(n+1,bta),'noscale'); [hh1,w1]=freqz(h1,1,256); figure(1) subplot(2,1,1) plot(w1/pi,20*log10(abs(hh1))) grid xlabel('歸一化頻率w');ylabel('幅度/db'); subplot(2,1,2) plot(w1/pi,angle(hh1)) grid xlabel('歸一化頻率w');ylabel('相位/rad'); 窗函數法 Robot and Servo Drive Lab.

  5. 窗函數法 Robot and Servo Drive Lab.

  6. 窗函數法 我在輸入freqz(h1,1,256) Robot and Servo Drive Lab.

  7. 等波紋法 • 所謂最佳化就是讓濾波器的頻率響應﹐在衰減帶的起伏(Ripple)等量平均的變化﹐稱為Equiripple。使用的演算法稱為Parks-McClellanalgorithm Robot and Servo Drive Lab.

  8. 等波紋法 [n,fpts,mag,wt]=remezord([0.3 0.45 0.65 0.8],[0 1 0],[0.01 0.1087 0.01]); h2=remez(n,fpts,mag,wt); [hh2,w2]=freqz(h2,1,256); figure(2) subplot(2,1,1) plot(w2/pi ,20*log10(abs(hh2))) grid xlabel('歸一化頻率w');ylabel('幅度/db'); subplot(2,1,2) plot(w2/pi,angle(hh2) ) grid xlabel('歸一化頻率w');ylabel('相位/rad'); Robot and Servo Drive Lab.

  9. 等波紋法 Robot and Servo Drive Lab.

  10. 等波紋法 我再輸入freqz(h2,1,256) Robot and Servo Drive Lab.

  11. 比較 幅度頻譜差值越小,實際濾波器就越接近理想濾波器。 而等波紋濾波器是通過最大加權誤差最小化來實現,其誤差為: Robot and Servo Drive Lab.

  12. 比較 對比二者的幅度頻譜可知,等波紋濾波器阻帶邊緣比用窗函數實現的更平滑(理想濾波器為垂直下降的)。   從設計的角度考慮,由於窗函數設計法都是通過已有的窗函數對理想濾波器的改造,因此,可以用手算的辦法方便的設計濾波器。 而等波紋濾波器,其實現是通過大量的迭代運算來實現,這樣的方法一般只能通過軟件來設計。   項數的問題由於等波紋濾波器能較平均的分佈誤差,因此對於相同的阻帶衰減,其所需的濾波係數比窗函數的要少。 Robot and Servo Drive Lab.

  13. 比較 上面第一個圖是用rad為單位 畫出來的,下面的圖是用角度 單位畫出來的。 從圖形可以觀察到在0.3 到 0.8 數字頻率間兩個圖都是嚴 格的線性相位,至於上面的圖 為什麼在這個區間會有跳變是 因為rad 的區間只有-pi ——  pi ,當相位由-pi 繼續增加時 只能跳到pi 而不能大於pi , 而角度表示則可以連續增大。 Robot and Servo Drive Lab.

  14. 結果分析 濾波器實現形式及特點:由於一般的濾波器在利用窗函數是其通帶波紋 和阻帶波紋不同(一般為第一個阻帶波紋最大)因此,在滿足第一個阻 帶衰減旁瓣時,比其頻率高的旁瓣,它們的衰減都大大超出要求。而根 據阻帶衰減與項數的近似關係N = P(δ 2)*f s/TW,可得當阻帶衰減越大, 所需項數越多 Robot and Servo Drive Lab.

More Related