% M12-winfir.diary
% FIR design by windowed FIR
% dpwe@ee.columbia.edu
% 2007-11-15
% Desired break frequency
wc = 0.15*pi;
% half-length of window
M = 12;
% Tapered window
w = hamming(2*M+1)';
% Hence windowed ideal LPF
h = sin(wc*[-M:M])./(pi*[-M:M]).*w;
% but divide-by-zero at center point
h([M M+1 M+2])
% .. so set it by hand (to what it should be)
h(M+1) = wc/pi*w(M+1); % w(M+1) == 1.0, center point of window
% Look at impulse response
subplot(211)
stem(h)
% .. just middle bump of sinc
% Frequency response
freqz(h)
% Not a very sharp filter!
% Convert to a highpass filter:
% Need to subtract it from a unity filter (an impulse)
% with the same linear phase (delay)
h0 = zeros(1, 2*M+1);
h0(M+1) = 1;
freqz(h0-h);