Bandpass filter using firpmord

47 次查看(过去 30 天)
Maria Stroe
Maria Stroe 2018-3-29
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 CenterFile Exchange 中查找有关 Digital and Analog Filters 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by