Filter designing using Kaiser window
19 次查看(过去 30 天)
显示 更早的评论
Hi! I'm just new to Matlab and still struggling to find a solution for my assignment. The task is to design a low pass, high pass, and band pass filers with the support of Kaiser window method. can somebody show me a possible way. Thanks!
0 个评论
回答(1 个)
Star Strider
2016-12-16
Here is some example code for an Answer I posted a few days ago. Since this is a homework assignment, I will let your puzzle through it to understand how it works.
The Code:
Fs = 1E+4; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = [0.1 0.5 100 110];
fsamp = Fs;
fcuts = Wp;
mags = [0 1 0];
devs = [0.05 0.01 0.05];
[n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,fsamp);
n = n + rem(n,2);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'scale');
figure(1)
freqz(hh, 1, 2^nextpow2(length(hh)), Fs)
figure(2)
freqz(hh, 1, 2^nextpow2(length(hh)), Fs)
set(subplot(2,1,1), 'XLim', [0 150]) % Zoom Frequency-Axis
set(subplot(2,1,2), 'XLim', [0 150]) % Zoom Frequency-Axis
figure(3)
freqz(hh, 1, 2^nextpow2(length(hh)), Fs)
set(subplot(2,1,1), 'XLim', [0 10]) % Zoom Frequency-Axis
set(subplot(2,1,2), 'XLim', [0 10]) % Zoom Frequency-Axis
It is a bandpass filter for EKG filtering, with a passband of 0.5 Hz to 100 Hz. See the documentation for the relevant functions for details on how to use them.
2 个评论
Helia
2023-11-17
Hi, could you explain why you used "n = n + rem(n, 2)"? I couldn't figure out the reason.
Thanks
Star Strider
2023-11-17
My pleasure.
See what it actually does —
for n = 9:12
n
n = n + rem(n,2)
disp(' ')
end
It calculates the order ‘n’ so that it will always be even.
.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Kaiser 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!