Keywords: Frequency response of 3-term boxcar filter.gif discrete time Fourier transform of a 3-tap boxcar filter To produce these plots samples of the DTFT are obtained by computing the DFT of the zero-filled impulse response Alternatively one can directly sample the closed form of the DTFT <math>\scriptstyle H j\omega \frac 1 3 \left 1 + e -j\omega + e -j2\omega \right </math> and plot the magnitude and angle of the samples See File MA2Amp_C svg <br> Note At the two frequencies where the magnitude goes to zero there are phase discontinuities of Ï radians They are not artifacts of phase wrapping Rather they indicate a sign inversion multiplication by -1 Since that is equivalent to an amplitude modification it does not affect the filter's property of phase linearity An illustration of that can be viewed at File Amplitude phase vs frequency for a 3-term boxcar filter gif 2014-04-06 20 35 13 own Bob K Octave script <source lang Matlab > graphics_toolkit gnuplot N 256; h 1 1 1/3; impulse response H fftshift fft h N ; samples of DTFT abscissa -N/2 N/2-1 2 pi/N; normalized frequency figure subplot 2 1 1 plot abscissa abs H ; xlim -pi pi ylim 0 1 2 set gca 'XTick' -pi -2 pi/3 0 2 pi/3 pi set gca 'YTick' 0 2 4 6 8 1 grid 'on' xlabel '\leftarrow Frequency \omega radians/sample \rightarrow' ylabel 'Magnitude' set gca 'XTickLabel' '-\pi'; '-2\pi/3'; '0'; '2\pi/3'; '\pi'; 'interpreter' 'tex' set gca 'YTickLabel' '0'; '0 2'; '0 4'; '0 6'; '0 8'; '1 0'; title 'Frequency response of 3-term boxcar filter' 'fontsize' 12 Gnuplot bug Without the following command the title gets cropped out of the figure But this command also causes subplot 1 to have less height than subplot 2 set gca 'position' get gca 'position' - 0 0 0 0 02 subplot 2 1 2 plot abscissa angle H ; xlim -pi pi ylim -pi pi set gca 'XTick' -pi -2 pi/3 0 2 pi/3 pi set gca 'YTick' -pi -2 -1 0 1 2 pi grid 'on' Gnuplot bug xlabel gets cropped out of the figure xlabel '\leftarrow Frequency \omega radians/sample \rightarrow' ylabel 'Phase radians ' set gca 'XTickLabel' '-\pi'; '-2\pi/3'; '0'; '2\pi/3'; '\pi'; 'interpreter' 'tex' set gca 'YTickLabel' '-\pi'; '-2'; '-1'; '0'; '1'; '2'; '\pi'; 'interpreter' 'tex' </source> cc-zero Uploaded with UploadWizard Phase plots Bode plots |