---
title: "Rectangular window in FIR design; Gibbs oscillations"
subject: "Digital Signal Analysis and Processing"
chapter: 5
key: "semester_7/digital_signal_analysis_and_processing:rectangular-window-gibbs"
source: https://www.bctengineer.com/q/semester_7/digital_signal_analysis_and_processing/rectangular-window-gibbs
site: BCT Engineering
---

# Rectangular window in FIR design; Gibbs oscillations

Digital Signal Analysis and Processing · Chapter 5: FIR Filter Design

- Asked in: 2073 Shrawan, 6 marks; 2071 Shrawan, 6 marks (asked 2 times)
- Video: [FIR Filter Design: Different Window Functions Explained (Rectangular, Hamming, Hanning, Blackman)](https://www.youtube.com/watch?v=jg0sC9D1I8E) — EC Academy
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/digital_signal_analysis_and_processing/rectangular-window-gibbs
- Whole chapter: https://www.bctengineer.com/md/semester_7/digital_signal_analysis_and_processing/chapter-5

## Question

Explain in detail about how rectangular window is used in FIR filter design. How do Gibbs oscillations arise in this process?

## Short answer

To design an FIR filter, truncate the shifted ideal impulse response with a rectangular window of length M (w(n)=1). Gibbs oscillations arise because multiplication in time means convolution in frequency; the rectangular window's spectrum has large side lobes that cause ripples and a ~9% overshoot at the discontinuity, independent of filter length.

## Answer

#### Using the rectangular window
An ideal low-pass filter has H_d(e^jω) = 1 for |ω| ≤ ωc and 0 otherwise. Its impulse response is infinite and non-causal:

h_d(n) = sin(ωc(n − α)) / (π(n − α)),  n ≠ α;  h_d(α) = ωc/π

To get a finite, causal filter of length M, shift the ideal response by α = (M−1)/2 and multiply it by a window w(n):

h(n) = h_d(n) · w(n)

For the **rectangular window**, w(n) = 1 for 0 ≤ n ≤ M−1 and 0 otherwise, so the impulse response is simply the ideal response truncated to M samples. Steps:

1. Specify ωc (the midpoint of the transition band) and M.
2. Compute h_d(n) for n = 0 … M−1 with α = (M−1)/2.
3. h(n) = h_d(n) for 0 ≤ n ≤ M−1.
4. Check the response; increase M if the transition is too wide.

The result is symmetric, so the phase is linear. Properties: the main lobe is 4π/M wide (so the transition is narrow), but the first side lobe is only 13 dB down, giving a minimum stop-band attenuation of about 21 dB.

#### Why Gibbs oscillations arise
Windowing in time is multiplication, which means **convolution in frequency**:

H(e^jω) = (1/2π) ∫ H_d(e^jθ) W(e^j(ω−θ)) dθ

The spectrum of the rectangular window, with amplitude sin(Mω/2)/sin(ω/2), has a main lobe and large side lobes. As this kernel slides across the sharp (brick-wall) edge of the ideal response, the side lobes alternately add and subtract area, giving ripples in the pass band and stop band. Near the edge, the response overshoots the ideal value by about 9 %, and the ripples die out slowly away from the edge. This is the **Gibbs phenomenon**: truncating a Fourier series at a discontinuity always leaves an overshoot.

Key points:

- Increasing M makes the ripples narrower and moves them closer to the edge, but their **height stays about 9 %** (the minimum stop-band attenuation stays near 21 dB).
- The cure is to use a window with a gradually tapering shape (Hamming, Hanning, Blackman, Kaiser). These have smaller side lobes and so smaller ripple, at the cost of a wider transition band.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. How is the ideal low-pass impulse response made finite and causal in the rectangular window method?
   A. Truncate to M samples and shift by alpha = (M-1)/2
   B. Multiply by a Hamming window
   C. Use alpha = M
   D. Double the samples
   Answer: A. h(n) = h_d(n) for 0 <= n <= M-1, with h_d shifted by alpha = (M-1)/2. (Key point: Shifting for causality)

2. Which describes the rectangular window?
   A. Wide main lobe, very low side lobes
   B. Narrowest main lobe (4pi/M), first side lobe only 13 dB down, ~21 dB stop-band attenuation
   C. Main lobe 8pi/M, 53 dB attenuation
   D. Adjustable by beta
   Answer: B. Its narrow main lobe gives a sharp transition but the large side lobes limit attenuation to about 21 dB. (Key point: Rectangular window properties)

3. Why do Gibbs oscillations arise?
   A. Time-domain multiplication is frequency-domain convolution; the window's side lobes convolved with the ideal brick-wall response give ripples
   B. Because M is too large
   C. Because the filter is IIR
   D. Because the phase is nonlinear
   Answer: A. Side lobes of W add and subtract area as the sharp edge slides through, causing ripples and ~9% overshoot. (Key point: Origin of Gibbs)

4. What happens to the Gibbs ripple when M is increased?
   A. Its height drops to zero
   B. Ripples get narrower and closer to the edge but height stays about 9%
   C. Ripples get wider
   D. Overshoot doubles
   Answer: B. Increasing M doesn't reduce the peak ripple; use a tapered window to do so. (Key point: Effect of M)

## Related in Digital Signal Analysis and Processing

- [Low-pass FIR window design, αs = 40 dB](https://www.bctengineer.com/question.md?key=semester_7%2Fdigital_signal_analysis_and_processing%3Afir-lowpass-window-0-3-0-5-40) — Digital Signal Analysis and Processing, chapter 5, asked 2×
- [Hanning window low-pass FIR design](https://www.bctengineer.com/question.md?key=semester_7%2Fdigital_signal_analysis_and_processing%3Afir-hanning-window-design) — Digital Signal Analysis and Processing, chapter 5
- [Describe FIR design by window method](https://www.bctengineer.com/question.md?key=semester_7%2Fdigital_signal_analysis_and_processing%3Awindow-method-describe) — Digital Signal Analysis and Processing, chapter 5, asked 2×
- [Low-pass FIR window design, αs = 41 dB](https://www.bctengineer.com/question.md?key=semester_7%2Fdigital_signal_analysis_and_processing%3Afir-lowpass-window-0-2-0-5-41) — Digital Signal Analysis and Processing, chapter 5
- [Kaiser low-pass FIR, passband 0.9π, stop 0.14π](https://www.bctengineer.com/question.md?key=semester_7%2Fdigital_signal_analysis_and_processing%3Akaiser-lowpass-0-9-0-14) — Digital Signal Analysis and Processing, chapter 5, asked 2×
- [Kaiser low-pass FIR, 0.19π and 0.21π](https://www.bctengineer.com/question.md?key=semester_7%2Fdigital_signal_analysis_and_processing%3Akaiser-lowpass-0-19-0-21) — Digital Signal Analysis and Processing, chapter 5, asked 2×

## Related in other subjects

- [Ergodic process; matched filter impulse response](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Aergodic-matched-filter) — Communication Systems, chapter 9
- [Unit operation, process; need of trickling filter](https://www.bctengineer.com/question.md?key=semester_6%2Fsanitary_engineering%3Aunit-operation-process-trickling-need) — Sanitary Engineering, chapter 7
- [Insertion loss design of given LC ladder filter](https://www.bctengineer.com/question.md?key=semester_7%2Frf_and_microwave_engineering%3Afilter-ladder-insertion-loss-microstrip) — RF and Microwave Engineering, chapter 6
- [Best hydraulic rectangular canal design](https://www.bctengineer.com/question.md?key=semester_6%2Fhydro_power%3Abest-rectangular-canal-design) — Hydro Power, chapter 1
