SignalUtils.RemoveDC Method

Overload List

#SignatureDescription
1function RemoveDC(const SrcDst: TVec): TVec;In-place version of the RemoveDC method.
└ indexed: function RemoveDC(const SrcDst: TVec; Index: Integer; Len: Integer): TVec;
2procedure RemoveDC(const Src: TVec; const Dst: TVec);Not-In-place version of the RemoveDC method.
└ indexed: procedure RemoveDC(const Src: TVec; const Dst: TVec; SrcIndex: Integer; DstIndex: Integer; Len: Integer);

Overload 1: function RemoveDC(const SrcDst: TVec): TVec;

In-place version of the RemoveDC method.

#NameTypeDescription
1SrcDstTVec

Returns: TVec

Indexed: function RemoveDC(const SrcDst: TVec; Index: Integer; Len: Integer): TVec;

Remove the DC component.

#NameTypeDescription
1SrcDstTVec
2IndexIntegerstart index
3LenIntegerelement count

Returns: TVec

Remarks:

Subtract the mean value of Data from Data. Works for stationary signals. Use a highpass FIR filter for signals with varying mean value or call the DcFilter routine, for an IIR version of the DC filter. Removing the DC component without applying a true FIR
or IIR filter is often convinient prior to frequency analysis, because there is no run-in or run-out and no filter delay.

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

procedure TForm1.Button1Click(Sender: TObject);
var b,c,Response1, Response2: Vector;
begin
    Tone(b, 256,6/256,0,1);
    b := b + 4; //generate 6 periods within 256 samples, Phase = 0, Amplt = 1
    c.Copy(b);
    RemoveDC(b);
    DrawIt([c,b],['Original signal','Signal without DC']);
    FrequencyResponse(c,nil,Response1,1,True);
    FrequencyResponse(b,nil,Response2,1,True);
    DrawIt([Response1, Response2],['Spectrum: original signal','Spectrum: signal without DC']);
end;
See Also: SignalUtils.FirFilter, SignalUtils.KaiserImpulse, OptimalFir.RemezImpulse

Overload 2: procedure RemoveDC(const Src: TVec; const Dst: TVec);

Not-In-place version of the RemoveDC method.

#NameTypeDescription
1SrcTVec
2DstTVec

Result: stored in self (calling object)

Indexed: procedure RemoveDC(const Src: TVec; const Dst: TVec; SrcIndex: Integer; DstIndex: Integer; Len: Integer);

Not-in-place version of the RemoveDC method with source and destination indexes.

#NameTypeDescription
1SrcTVec
2DstTVec
3SrcIndexIntegersource start index
4DstIndexIntegerdestination start index
5LenIntegerelement count

Result: stored in self (calling object)

Remarks:

The Src data is preserved, the destination will hold the result. If Len is not specified, the maximum possible value will be used.