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!