How do IIR and FIR filtering create phase distortion (hence, shape modification for harmonic signals)? Try it by yourlsef.
The input signal is \[ x[n]=\sin(\phi_0 n)+0.8\sin(2\phi_0 n), \] with \[ \phi_0=\frac{2\pi F_0}{F_s}. \]
The time plot shows five periods of input and output signals, whatever the frequency selected by the slider, so as to make comparisons easier.
We have implemented two discrete low-pass filters, with with identical passband up to 2000 Hz, and at least 40dB of attenuation at 2240 Hz, for a sampling frequency of \(F_s=24\,\mathrm{kHz}\).
The elliptic recursive (IIR) filter has nonlinear phase. The symmetric non-recursive (FIR) filter is longer and even sharper than the IIR filter, but it keeps linear phase. As a result, the phase contribution of the FIR filter to the harmonic is always twice that on the fundamental, which results in a simple time delay of the whole input waveform. In contrast, the phase contribution of the IIR filter on both components results in shape distortion. This is especially visible when \(F_0 \approx 1000 Hz\), i.e., when the harmonic gets close to the edge of the passband.
Symmetric FIR filters are therefore typically used as decimation and interpolation filters, so as to avoid signal shape distortion. The price to pay for linear phase is the order of the FIR filters (here, 400) compared to that of IIR filters (here, 8).