From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Step response and time constant of filter

Hey guys,

 

I am looking for the formula which shows me the behaviour of a recursive moving average in the time domain. So i am looking for the step response in dependency of M, the amount of points used for averaging.

 

In general the step response is: transferfunction * unit step. But neither with the laplace transformation nor in the z-domain I am able to derive it.

 

The second question is: How do I get from the riste time (10% to 90%) to the -3dB freuqency or time constant? I know about t=TC*2,2 but I cant find a general derivation.

 

 

Kind regards

 

Slev1n

 

 

0 Kudos
Message 1 of 6
(3,793 Views)

I suspect that a textbook on Signal Theory will be helpful.  You might also find some useful information by doing a search on the Web.  Do you have colleagues who are Electrical Engineers (or EE students)?

 

Bob Schor

0 Kudos
Message 2 of 6
(3,782 Views)

Hi Slev1n,

 

a moving average is basically a FIR lowpass filter with constant filter coefficients.

In LabVIEW you can find a lot of filter functions. I attached a little example of how i would implement a moving average using the VI under:

 

Signal Processing >> Filter >> Advanced FIR Filtering >> FIR Filter

 

The order M of the filter is determined by the size of the array containing the filter coefficients. For example averaging over 5 points in time you need to

initialize a array of size 5 and each value would be 1/5.

 

I hope I understood your questions and this gives you a bit of help to get going from here.

 

Greetings.

 

 

0 Kudos
Message 3 of 6
(3,739 Views)

Hey guys,

 

thanks for your help.

You are both right so far 🙂

 

I managed to plot the frequency magnitude response, impulse and step response of a "moving average" and an "exponentially weighted moving average" filter. I also implemented to plot the responses of mutiple pass MA or EWMA.

 

Therefor I used the "signal processing --> filter --> advanced IIR Filter --> smoothing filter coefficients.vi" and the "DFD Toolkit" to cascade and plot them. Usefull is also the example: "Build an EWMA filter.vi".

 

I also managed to find literature for the relation between "time constant" and alpha (for EWMA) but I don't find a source for the following equation explaining the relation between the filter lenght M of a Moving Average and the cut off frequency/ time constant.

 

Fc = 1/(2*pi*TC)  = 0,44294 / (sqrt(M^2)-1); TC=time constant and the formula is equal for N>=2

 

This formula seems to be right, because from my magnitude response I can derive the cut off frequency Fc and compare it with different filter lengths M. But I dont know how to get to this equation. Maybe someone knows literature, where I could find it?

 

kind regards

Slev1n

0 Kudos
Message 4 of 6
(3,722 Views)

Did you try Google?  I typed in EWMA (since I didn't know what that stood for) and Google filled in EWMA Formula (among other choices).

 

Bob Schor

0 Kudos
Message 5 of 6
(3,710 Views)

I am looking for a source for the formula I found by using google 🙂

 

And this formula is for the MA not EWMA. For EWMA I have a good book 🙂

0 Kudos
Message 6 of 6
(3,686 Views)