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

Filter data with a sample-and-decay filter.

Syntax
C#
Visual Basic
public static void SampleAndDecayFilter(TVec Data, ref TSampleAndHoldState State, double Decay);

Filter Data with a non-linear sample-and-decay filter. This filter is similar to Sample-And-Hold, except that the held value slowly decays until a bigger is found. The filter features streaming support via State variable. Data can be real or complex. The decay parameter defines how much will the value decay from sample to sample. The State variable has to be initialized with zeros before it is passed to the routine for the first time.

Sample and delay filter 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.SampleAndDecayFilter(b,ref State,0.95); } 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!