Implementation of filter bank using fir1

조회 수: 3 (최근 30일)
William Greenway
William Greenway 2022년 1월 22일
댓글: Paul 2022년 1월 23일
I'm trying to implement a filter bank using fir1 and a kaiser filter.
I have currently implemented my fir1 filter for the lowest frequency band
lpf = fir1(L-1,500/4000,kaiser(L,3));
and now need to shift this filter up to create a total of 10 bands at 250Hz intervals.
How can I shift up the bandpass filter? I would be looking to use some kind of for loop e.g. to apply some function to lpf in order to shift it up by the desired frequency?

채택된 답변

Paul
Paul 2022년 1월 22일
Take advantage of the frequency shift property of the DTFT.
For example
Fs = 1000;
f = (-0.5:.001:0.5)*Fs;
L = 50;
lpf = fir1(L-1,500/4000,kaiser(L,3));
h0 = freqz(lpf,1,f,Fs);
h250 = freqz(lpf.*exp(1j*250/Fs*2*pi*(0:(numel(lpf)-1))),1,f,1000);
figure
plot(f,abs([h0(:) h250(:)])),grid
xline(250)
xlabel('Frequency (Hz)');
ylabel('Magnitude')
This approach does result in the shifted filter having complex coefficients, which might not be what you want. If it's not what you want, the problem might have to be reformulated.
  댓글 수: 6
William Greenway
William Greenway 2022년 1월 23일
Sure that makes sense! Thanks very much for your answer :)
I'm trying to design a bank of 10 filters shifted by 250Hz each filter. Is there any way of creating a bank of 10 filters without the periodicity having the effect that you mentioned (i.e. getting rid of the other periods than the first half period)?
Also why is lpf now a bandpass filter when before it was a low pass filter?
Paul
Paul 2022년 1월 23일
As to the second question, it looks like the filter design parameters changed. As shown, lpf from the original code was low pass and from the new code is bandpass.
Fs = 8000;
f = (-0.5:.001:0.5)*Fs;
L = 50;
lpf = fir1(L-1,500/4000,kaiser(L,3)); % lpf in the original question
fcuts = [1000 1300 2210 2410];
mags = [0 1 0];
devs = [0.01 0.05 0.01];
fsamp = Fs;
[n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,fsamp);
n = n + rem(n,2);
lpfnew = fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale'); % lpf from comment above
[h0,f0] = freqz(lpf,1,1024,Fs);
[hnew,fnew] = freqz(lpfnew,1,1024,Fs);
figure
plot([f0 fnew],abs([h0 hnew])),grid
legend('lpf','lpfnew')
As to the first question, maybe you could achieve your goal by designing 10 different filters and adding them together (rather than shifted copies of a single filter) to get the desired, overall frequency response.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Digital Filter Design에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by