function Hilbert(const SrcDst: TVec): TVec;
Applies hilbert transform to Src.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | SrcDst | TVec |
Returns: TVec
Remarks:
Applies hilbert transform to Src. Src must be real signal. The result is complex. Hilbert transform generates a 90 degree phase shifted version of the original. This becomes the imaginary part of the complex signal. This routine is very usefull for single block processing, but can not be used for streaming data. Use a digital FIR filter based hilbert transformer for streaming data or resort to quadrature sampling techniques [1], p. 297.
References:
[1] Understanding digital signal processing. Richard G. Lyons, Prentice-Hall, 2001.
Examples
uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee, MtxVecEdit;
procedure TForm1.Button1Click(Sender: TObject);
var h,h1,Re,Im: Vector;
begin
h := Math387.Sin(Ramp(256, mvDouble,0,2*Pi*6/256));
SignalUtils.Hilbert(h);
h.CplxToReal(Re,Im);
DrawIt([Re,Im],['Real','Imag'],'Integer frequency');
h1.SetIt(false,[Re.DotProd(Im)]);
ViewValues(h1,'Dot product between Re and Im',True);
h := Math387.Sin(Ramp(256, mvDouble,0,2*Pi*6.5/256));
SignalUtils.Hilbert(h);
h.CplxToReal(Re,Im);
DrawIt([Re,Im],['Real','Imag'],'Non-integer frequency');
h1.SetIt(false,[Re.DotProd(Im)]);
ViewValues(h1,'Dot product between Re and Im',True);
h := Math387.Sin(Ramp(256, mvDouble,0,2*Pi*6.5/256));
Re.Copy(h);
Im.Copy(h);
KaiserImpulse(h1,[0.95,1],0.01,ftHilbertIII);
//Or use remez: RemezImpulse(h1,[0.05,0.95],0.01,ftHilbertIII);
FirFilter(Im,h1); //also compensates for integer filter delay (if filter is Odd length (type III))
DrawIt([Re,Im],['Real ','Imag'],'With FIR filter');
h1.SetIt(false,[Re.DotProd(Im)]); //dot product between Re and Im should be zero
ViewValues(h1,'Dot product between Re and Im',True);
end;