Bandpass filter using firpmord

조회 수: 46 (최근 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 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