SignalUtils.Goertz Method

Overload List

#SignatureDescription
1procedure Goertz(const Src: TVec; const Freq: TVec; const Dst: TVec; PhaseCorrection: TGoertzPhaseCorrection);The Discrete Fourier transformation (DFT) for vector of frequencies.
2procedure Goertz(const Src: TVec; const Freq: TVec; const Dst: TVec; const SrcIndex: Integer; srcLen: Integer; PhaseCorrection: TGoertzPhaseCorrection);The Discrete Fourier transformation (DFT) for vector of frequencies.
3function Goertz(const Src: TVec; Freq: Double; PhaseCorrection: TGoertzPhaseCorrection): TCplx;The Discrete Fourier transformation (DFT) for a given frequency.
4function Goertz(const Src: TVec; Freq: Double; const SrcIndex: Integer; srcLen: Integer; PhaseCorrection: TGoertzPhaseCorrection): TCplx;The Discrete Fourier transformation (DFT) for a given frequency.

Overload 1: procedure Goertz(const Src: TVec; const Freq: TVec; const Dst: TVec; PhaseCorrection: TGoertzPhaseCorrection);

The Discrete Fourier transformation (DFT) for vector of frequencies.

#NameTypeDescription
1SrcTVec
2FreqTVec
3DstTVec
4PhaseCorrectionTGoertzPhaseCorrection

Result: stored in self (calling object)

Remarks:

Calculates the Discrete Fourier transformation (DFT) for an array of frequencies defined in the Freq parameter. Goertz returns the DFT of the frequencies pass as a parameter in the Dst variable. 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 Goertz method is faster, than direct DFT, if we need values at consecutively different frequencies. If at every call the values in Freq parameter are different. If the frequencies, at which we need to evalute the spectrum are fixed between calls, then the direct DFT method is faster.

See Also: SignalUtils.Goertz

Overload 2: procedure Goertz(const Src: TVec; const Freq: TVec; const Dst: TVec; const SrcIndex: Integer; srcLen: Integer; PhaseCorrection: TGoertzPhaseCorrection);

The Discrete Fourier transformation (DFT) for vector of frequencies.

#NameTypeDescription
1SrcTVec
2FreqTVec
3DstTVec
4SrcIndexIntegersource start index
5srcLenInteger
6PhaseCorrectionTGoertzPhaseCorrection

Result: stored in self (calling object)

Remarks:

SrcIndex and srcLen define the sub-range of Src on which to compute the function.

Overload 3: function Goertz(const Src: TVec; Freq: Double; PhaseCorrection: TGoertzPhaseCorrection): TCplx;

The Discrete Fourier transformation (DFT) for a given frequency.

#NameTypeDescription
1SrcTVec
2FreqDoublescalar
3PhaseCorrectionTGoertzPhaseCorrection

Returns: TCplx (complex)

Remarks:

Calculates the Discrete Fourier transformation (DFT) for a given frequency. Goertz returns the DFT at the Frequency. 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 Goertz method is faster, than direct DFT, if we need values at consecutively different frequencies. At every call the Freq parameter is different.

If the frequencies, at which we need to evalute the spectrum are fixed, then the direct DFT method is faster than Goertz.

The function applies Bonzanigo's phase correction. This means, that phase information is reliable and correct also when computed at an arbitrary non-integer frequency. An "integer frequency" is such that an (exact) integer number of periods fits in to the data (signal) of the specific length.

Examples
uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee, MtxVecEdit;

procedure TForm1.Button1Click(Sender: TObject);
var a: Vector;
begin
    Tone(a,256,5.5/256,0,12.53); //generate a tone
    //And now detect the amplitude at non-integer frequency:
    ShowMessage('Amplitude = ' + SampleToStr(CAbs(Goertz(a,5.5/256))/128));
end;
See Also: SignalUtils.GoertzTwo

Overload 4: function Goertz(const Src: TVec; Freq: Double; const SrcIndex: Integer; srcLen: Integer; PhaseCorrection: TGoertzPhaseCorrection): TCplx;

The Discrete Fourier transformation (DFT) for a given frequency.

#NameTypeDescription
1SrcTVec
2FreqDoublescalar
3SrcIndexIntegersource start index
4srcLenInteger
5PhaseCorrectionTGoertzPhaseCorrection

Returns: TCplx (complex)

Remarks:

SrcIndex and srcLen define the sub-range of Src on which to compute the function.