% Comb_1.m
% Calculating IIR filter coefficients of 2nd Order IIR Filter 


a = [0.5 0 0.5 * 25000/32767];
b = [1];

Fs = 48000          % Sampling frequency 
[H,f] = freqz ( b, a, 1024, Fs)
magnitude = 20 * log10(abs(H));
plot ( f, magnitude), grid on
xlabel ('Frequency (kHz)');
ylabel ('Magnitude Response (dB)');
title ('Comb Band Pass Filter Using 2 Delay Elements. 48000 Hz Sampling');
set (gca, 'xlim', [0, 24000])
set (gca, 'XTick', [0, 2000, 4000, 6000, 8000, 10000, 12000, 14000, 16000, 18000, 20000, 22000, 24000])
set (gca, 'XTickLabel', [0 2 4 6 8 10 12 14 16 18 20 22 24])
set (gca, 'ylim', [-42, 6])
set (gca, 'YTick', [-42, -36, -30, -24, -18, -12, -6, 0, 6])
set (gca, 'YTickLabel', [-42, -36,-30, -24, -18, -12, -6, 0, 6])
%zplane ( b, a)