## Goertzel Filterbank to the Implementation of a Nonuniform DFT

December 14, 20101 comment Coded in Matlab

This is an implementation of a Nonunifor Discrete Fourier Transform through a bank of filters of Goertzel.  Each goertzel filter is centered at the exactly frequencies of interest.

``````% VectorGoertzel    Goertzel's Algorithm filter bank.
%   Realization of the Goertzel's Algorithm to compute the Nonuniform DFT
%   of a signal(a column vector named signalw) of length Nw with sampling
%   frecuency fs at the desired frecuencies contained in vector f. The
%   function returns the NDFT magnitude in a vector with the same length of f.

function xk=Gfilterbank(signalw,f,fs,Nw)

% Inititialization of the different variables
n=2;
signalw=signalw(1:Nw);

cost=cos(2*pi*f/fs);
sint=sin(2*pi*f/fs);
L=length(cost);

y1(1:L)=0;
y2(1:L)=0;
signalw=[0 0 signalw]; %Signal is delayed by two samples

% Goertzel Feedback Algorithm

while((n-2) < Nw)
n=n+1;
xnew(1:L)=signalw(n);
y=xnew+2*cost.*y1-y2;
y2=y1;
y1=y;
end

% Goertzel Forward Algorithm

rey=y1-y2.*cost;
imy=y2.*sint;

% Magnitude Calculation

xk=abs(rey+imy*j)';``````