You are here: Symbol Reference > Dew Namespace > Dew.Signal Namespace > Dew.Signal.Units Namespace > Classes > SignalUtils Class > SignalUtils Methods > SignalUtils.SampleAndHoldFilter Method
Dew Signal for .NET
ContentsIndexHome
PreviousUpNext
SignalUtils.SampleAndHoldFilter Method

Filter data with a sample-and-hold filter.

Syntax
C#
Visual Basic
public static void SampleAndHoldFilter(TVec Data, ref TSampleAndHoldState State, int Hold);

Filter Data with a non-linear sample-and-hold filter. The current value is held until a bigger is found or time-out occurs. Time out is defined in samples with Hold parameter. The filter features streaming support via the State variable. Data can be real or complex. The State variable has to be initialized with zeros before it is passed to the routine for the first time.

SampleAndHoldFilter example on a sine.

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 num = new Vector(0); int n = 10; int i; TSampleAndHoldState State = new TSampleAndHoldState(); SignalUtils.Tone(b,300,5.0/300,0,1,false); c.Copy(b); int bLength = b.Length; for (i = 0; i < (bLength/n); i++) { b.SetSubRange(i*n,n); SignalUtils.SampleAndHoldFilter(b,ref State, 7); } b.SetFullRange(); MtxVecTee.DrawIt(new TVec[2] {c,b}, new string[2] {"Unfiltered","Filtered"},"SampleAndDecay",false); }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!