How to design a lowpass filter using rectangular windowing ??
6 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Nathan
on 28 Apr 2025
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 Comments
See Also
Categories
Find more on Digital Filter Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
