SignalUtils.RemoveDC Method

Overload List

#SignatureDescription
1TVec RemoveDC(TVec SrcDst)In-place version of the RemoveDC method.
└ indexed: TVec RemoveDC(TVec SrcDst, Int32 Index, Int32 Len)
2void RemoveDC(TVec Src, TVec Dst)Not-In-place version of the RemoveDC method.
└ indexed: void RemoveDC(TVec Src, TVec Dst, Int32 SrcIndex, Int32 DstIndex, Int32 Len)

Overload 1: TVec RemoveDC(TVec SrcDst)

In-place version of the RemoveDC method.

#NameTypeDescription
1SrcDstTVecsource TVec

Returns: TVec

Indexed: TVec RemoveDC(TVec SrcDst, Int32 Index, Int32 Len)

Remove the DC component.

#NameTypeDescription
1SrcDstTVecsource TVec
2IndexInt32start index
3LenInt32element 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
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 b = new Vector(0);
    Vector c = new Vector(0);
    Vector Response1 = new Vector(0);
    Vector Response2 = new Vector(0);

    SignalUtils.Tone(b, 256, 6.0 / 256, 0, 1, false);
    b = b + 4;
    c.Copy(b);
    SignalUtils.RemoveDC(b);
    MtxVecTee.DrawIt(new TVec[2] {c,b}, new string[2] {"Original signal","Signal without DC"},"Time signals", false);
    SignalUtils.FrequencyResponse(c, null, Response1, 1, true, TSignalWindowType.wtRectangular, 0);
    SignalUtils.FrequencyResponse(b, null, Response2, 1, true, TSignalWindowType.wtRectangular, 0);
    MtxVecTee.DrawIt(new TVec[2] {Response1,Response2}, new string[2] {"Spectrum: original signal","Spectrum: signal without DC"}, "Frequency spectrum", false);
See Also: SignalUtils.FirFilter, SignalUtils.KaiserImpulse, OptimalFir.RemezImpulse

Overload 2: void RemoveDC(TVec Src, TVec Dst)

Not-In-place version of the RemoveDC method.

#NameTypeDescription
1SrcTVecsource TVec
2DstTVecsource TVec

Result: stored in self (calling object)

Indexed: void RemoveDC(TVec Src, TVec Dst, Int32 SrcIndex, Int32 DstIndex, Int32 Len)

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

#NameTypeDescription
1SrcTVecsource TVec
2DstTVecsource TVec
3SrcIndexInt32source start index
4DstIndexInt32destination start index
5LenInt32element 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.