Implementation of filter bank using fir1
조회 수: 3 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
채택된 답변
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
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 Center 및 File Exchange에서 Digital Filter Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!