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!

回答(1 个)

Star Strider
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
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
Star Strider 2023-11-17
My pleasure.
See what it actually does —
for n = 9:12
n
n = n + rem(n,2)
disp(' ')
end
n = 9
n = 10
n = 10
n = 10
n = 11
n = 12
n = 12
n = 12
It calculates the order ‘n’ so that it will always be even.
.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by