% Goertzel_697.m
% Calculating IIR filter coefficients

% Numerator coefficients

B0 = 32767;

% Denominator coefficients

A0 = 32767;
A1 = -27906 * 2;
A2 = 32767;

b = [B0 ];
a = [A0 A1 A2];

Fs = 8000          % Sampling frequency 
[H,f] = freqz ( b, a, 256, Fs)
magnitude = 20 * log10(abs(H));
plot ( f, magnitude), grid on
xlabel ('Frequency (Hz)');
ylabel ('Magnitude Response (dB)');
title ('Goertzel Filter 697 Hz. 8000 Hz Sampling');
set (gca, 'xlim', [0, 2000])
set (gca, 'XTick', [0, 500, 1000, 1500, 2000])
set (gca, 'XTickLabel', [0 500 1000 1500 2000])
set (gca, 'ylim', [-6, 42])
set (gca, 'YTick', [-6, 0, 6, 12, 18, 24, 30, 36, 42])
set (gca, 'YTickLabel', [-6, 0, 6, 12, 18, 24, 30, 36, 42])