Design a high pass filter using kaiser window

16 ビュー (過去 30 日間)
Gehan Kavinda
Gehan Kavinda 2016 年 12 月 16 日
編集済み: John BG 2016 年 12 月 18 日
I could not find any documentation regarding high pass filter design using kaiser window. I need a help on this problem

採用された回答

John BG
John BG 2016 年 12 月 16 日
編集済み: John BG 2016 年 12 月 18 日
Hi Gehan
there are different ways to build a HPF with Kaiser time windowing
1.- manually building the time window for a LPF
% 1.- LPF with desired window
wp=0.2*pi;ws=.3*pi;As=45;Ap=.3 % As and Ap in dB
tr_width=ws-wp; % transition width
M=ceil((As-7.95)/(2.285*tr_width)+1)+1 % filter length
if As>=50 % As in dB
beta=0.1102*(As-8.7)
end
if As<50 && As>=21
beta=0.582*(As-21)^.4+.07886*(As-21)
end % mind the gag, no calculation for As<21dB
% from http://melodi.ee.washington.edu/courses/ee518/notes/lec17.pdf
% beta controls both width and tapering off i.e. beta increasing then width
% increases but sidelobe amplitudes decrease (good)
n=[0:1:M-1]
wc=(ws+wp)/2;hd=ideal_lp(wc,M);
w_kai=(kaiser(M,beta))';h=hd.*w_kai;
[db,mag,pha,grd,w]=freqz_m(h,[1]);
delta_w=2*pi/1000;
% As=-round(max(db(ws/delta_w+[1:1:501]))) % min stop band attenuation
subplot(2,2,1);stem(n,hd);title('ideal impulse response')
axis([0 M-1 -0.1 .3]);xlabel('n');ylabel('hd(n)')
subplot(2,2,2);stem(n,w_kai);title('Kaiser time window')
axis([0 M-1 0 1.1]);xlabel('n');ylabel('w(n)')
subplot(2,2,3);stem(n,h);title('actual impulse response')
axis([0 M-1 -.1 .3]);xlabel('n');ylabel('h(n)')
subplot(2,2,4);plot(w/pi,db);title('|HkaiLPF| dB');grid
axis([0 1 -100 10]);xlabel('frequency in pi units');ylabel('dB')
and then applying the frequency translation
That luckily I am not doing here because oh wonder MATLAB has a single command to do it all:
HpFilt = designfilt('highpassfir','PassbandFrequency',0.3, ...
'StopbandFrequency',0.2,'PassbandRipple',0.5, ...
'StopbandAttenuation',45,'DesignMethod','kaiserwin');
figure(2);fvtool(HpFilt)
dataIn = rand(1000,1);
figure; subplot(2,1,1);plot(dataIn);title('input noise')
subplot(2,1,2);plot(dataOut);title('HPF Kai filtered noise')
the LPF obtained by 'mirroring' the HPF around the transition band would be
LpFilt = designfilt('lowpassfir','PassbandFrequency',0.2, ...
'StopbandFrequency',0.3,'PassbandRipple',0.5, ...
'StopbandAttenuation',45,'DesignMethod','kaiserwin');
figure(1);fvtool(LpFilt)
dataIn = rand(1000,1);
dataOut = filter(LpFilt,dataIn);
subplot(2,1,1);plot(dataIn);title('input noise')
subplot(2,1,2);plot(dataOut);title('LPF Kai filtered noise')
Gehan
if you find this answer useful would you please be so kind to mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help
please click on the thumbs-up vote link
thanks in advance
John BG

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeKaiser についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by