DSP Master VCL
|
Applies hilbert transform to Src.
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.
Hilbert transform of a sine signal is computed for two cases:
uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee, MtxVecEdit; procedure TForm1.Button1Click(Sender: TObject); var h,h1,Re,Im: Vector; begin h := 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 := 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 := 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;
#include "MtxExpr.hpp" #include "MtxVecEdit.hpp" #include "MtxVecTee.hpp" #include "SignalUtils.hpp" void __fastcall TForm1::BitBtn1Click(TObject *Sender) { sVector h,h1, Re, Im; h = Sin(Ramp(256, mvDouble,0,2*PI*6/256)); Signalutils::Hilbert(h); h.CplxToReal(Re,Im); DrawIt(OPENARRAY(TVec*,(Re, Im)), OPENARRAY(AnsiString,("Real","Imag")),"Integer frequency"); h1.SetIt(false,OPENARRAY(double,(Re.DotProd(Im))) ); ViewValues(h1,"Dot product between Re and Im",True); h = Sin(Ramp(256, mvDouble,0,2*PI*6.5/256)); Signalutils::Hilbert(h); h.CplxToReal(Re,Im); DrawIt(OPENARRAY(TVec*,(Re,Im)), OPENARRAY(AnsiString,("Real","Imag")),"Non-Integer frequency"); h1.SetIt(false,OPENARRAY(double,(Re.DotProd(Im)))); ViewValues(h1,"Dot product between Re and Im",True); h = Sin(Ramp(256, mvDouble,0,2*PI*6.5/256)); Re.Copy(h); Im.Copy(h); KaiserImpulse(h1,OPENARRAY(double,(0.95,1)),0.01,ftHilbertIII); //Or use remez: RemezImpulse(h1,OPENARRAY(double,(0.05,0.95)),0.01,ftHilbertIII); FirFilter(Im,h1); //also compensates for integer filter delay (if filter is Odd length (type III)) DrawIt(OPENARRAY(TVec*,(Re,Im)), OPENARRAY(AnsiString,("Real","Imag")),"FIR Filter"); h1.SetIt(false,OPENARRAY(double,(Re.DotProd(Im)))); //dot product between Re and Im should be zero ViewValues(h1,"Dot product between Re and Im",True); }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|
What do you think about this topic? Send feedback!
|