Bandpass filter using firpmord

65 ビュー (過去 30 日間)
Maria Stroe
Maria Stroe 2018 年 3 月 29 日
コメント済み: Wei-Han Hsiao 2020 年 7 月 31 日
Hello, So I have this bandpass filter with : 0 between 0 and 0.2*pi, 1 between 0.3*pi and 0.5*pi and 0 between 0.6*pi and pi. the passband ripple=0.01 and the stopband ripple=0.05 Sampling frequency=16kHz I have to use firpmord and I have no idea how to make the length of the f vector = 2*length(m)-2 Here is my code
m=[0 0 1 1 0 0]
f=[0 0.2*pi 0.3*pi 0.5*pi 0.6*pi pi]
dev=[0.05,0.05,0.01,0.01,0.05,0.05];
Fs=16000;
[n,fo,mo,w]=firpmord(f,m,dev,Fs)
  1 件のコメント
Wei-Han Hsiao
Wei-Han Hsiao 2020 年 7 月 31 日
1. First, you need to know that m (or so-called a) denotes the number of bands.
That is, m = 3 in your case since you have two stopbands and one passband.
2. Second, f is the edge frequency vecor that inherently removes the starting and
end points. Thus, 0 and pi in your f are redundant and should be removed.
3. Third, dev corresponds to m. Hence, your dev should have only 3 elements.
4. Last, f and Fs should have the same units. Use either radians or Hz.
So, under Fs = 16000 Hz, your codes should be modified as follows.
Fs=16000;
m=[0 1 0];
f=[0.2*Fs/2 0.3*Fs/2 0.5*Fs/2 0.6*Fs/2];
dev=[0.05 0.01 0.05];
Fs=16000;
[n,fo,mo,w]=firpmord(f,m,dev,Fs);
h = firpm(n,fo,mo,w);
figure,freqz(h,1,1024,Fs);
Hope it helps! ^^

サインインしてコメントする。

回答 (1 件)

Abhishek Ballaney
Abhishek Ballaney 2018 年 3 月 30 日
https://www.mathworks.com/help/signal/ref/firpmord.html

カテゴリ

Help Center および File ExchangeDigital Filter Design についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by