The Discrete Fourier transformation (DFT) for a given frequency.
Calculates the Discrete Fourier transformation (DFT) for a given frequency. Goertz returns the DFT at the Frequency defined with GoertzInit. Each value of the DFT computed by the Goertzel algorithm takes 2N+2 real multiplications and 4N real additions. FFT computes the DFT with N*log2(N) of real multiplications and additions. The algorithm is very efficient if the frequency at which the DFT is being estimated does not change between calls and the algorithm is reduced to a simple dot product.
Example 1
DFT of a single frequency.
uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee, MtxVecEdit;
procedure TForm1.Button1Click(Sender: TObject);
var a: Vector;
State: TGoertzState;
begin
Tone(a,256,5.5/256,0,12.53); //generate a tone
GoertzInit(5.5/256,false,State);
//And now detect the amplitude at non-integer frequency:
ShowMessage('Amplitude = ' + SampleToStr(CAbs(Goertz(a,State))/128));
end;
#include "MtxVecCPP.h" //MtxVecCPP.cpp must be included in the project
#include "MtxVecEdit.hpp"
#include "MtxVecTee.hpp"
#include "SignalUtils.hpp"
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
Vector a;
TGoertzState State;
Tone(a,256,5.5/256,0,12.53); //generate a tone with Amplt = 12.53
GoertzInit(5.5/256,false,State);
//And now detect the amplitude at non-integer frequency:
ShowMessage("Amplitude = " + SampleToStr(CAbs(Goertz(a,State))/128));
}
using Dew.Math;
using Dew.Math.Editors;
using Dew.Math.Units;
using Dew.Signal;
using Dew.Signal.Units;
using Dew.Math.Tee;
using Dew.Signal.Tee;
private void button1_Click(object sender, EventArgs e)
{
Vector a = new Vector(0);
TGoertzState State = new TGoertzState();
SignalUtils.Tone(a,256,5.5/256,0,12.53,false); //generate a tone
SignalUtils.GoertzInit(5.5/256,false,ref State);
//And now detect the amplitude at non-integer frequency:
MessageBox.Show("Amplitude = " + Math387.SampleToStr(Math387.CAbs(SignalUtils.Goertz(a,ref State))/128,0,15));
}