How to design a lowpass filter using rectangular windowing ??
조회 수: 6 (최근 30일)
이전 댓글 표시
lowpass filter of length 13 and cutoff frequency π/6 using the rectangular window.
1)Need to plot impulse response
2)Rectangular window
then
3)how the impulse response is affected by the rectangular window*
댓글 수: 0
답변 (1개)
Nathan
2025년 4월 28일
Hello,
The rectangular window has a uniform (1) value, as opposed to something like a Hamming window. There is usually nothing you have to "do" to use a rectangular window on a signal, because you're just multiplying by ones, but it's good practice to specify it in your code using something like "rectwin(n)" to remind any readers that the default has an effect on the signal output. In your case, you want to see how a window affects an impulse response:
1). to plot the impulse response of your filter:
[b, a] = fir1(13, pi/6, "low"); % sample low-pass FIR filter, order of 13, b and a are the LCCDE coefficeints
impz(b, a); % generates a plot of the impulse response of your filter.
2). Generate a rectangular window of some length:
n_samples = 10;
w = rectwin(10); % or just w = ones(1, n_samples);
3) In the time domain, you would do a convolution between your filter impulse response and the window directly:
h = impz(b, a); % get the impulse response itself
hwin = conv(w, h); % convolve the two
stem(hwin); % make a new plot
% usually you'd do this with a comparison between windows
whann = hann(10, "periodic");
hhann = conv(whann, h);
hold("on");
stem(hhann);
legend(["Rect. Window" "Hann Window"])
% there's a lot of frequency domain things you can do with this too to
% compare windows/filters, but if you need the impulse response, then this
% is it.
댓글 수: 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!

