Example of performing a Moving Average

  • Post author:
  • Reading time:3 mins read
  • Post comments:3 Comments

This tutorial guides a DATS user through the steps required to perform a moving average on a given signal. The tutorial explains the concept of the ‘Integration Length’ and the ‘Output Interval Step’.

Initially a signal is required to perform the moving average on. In this tutorial a sine wave will be generated. A sine wave is generated using the parameters shown in Figure 1.

Parameters for creating a sine wave
Figure 1 : Parameters for creating a sine wave

The Sine wave will have a duration of 8 seconds and a frequency of 1Hz, with an amplitude of 5 m/sec/sec in this case.

DATS with the generated sine wave
Figure 2: DATS with the generated sine wave

Figure 2 shows the DATS user interface with the sine wave generated. Next the moving average must be performed on the sine wave. To perform the moving average the DATS analysis module as shown in Figure 3 is used.

Selecting the Evaluate Trend function
Figure 3: Selecting the Evaluate Trend function

Under ‘Trend Analysis’, the option ‘Evaluate Trend (Mean)’ is used. Other options are available, but not required for this tutorial.

Moving average analysis parameters
Figure 4: Moving average analysis parameters

Figure 4 shows the moving average analysis parameters. In this example the ‘Interval Style’ parameter is set to ‘Independent Units’, this parameter can be set to ‘Points’ or ‘Independent Units’. When set to ‘Independent Units’ the ‘Integration Length’ and the ‘Output Interval Step’ are measures of the X axis unit. For example, a signal where the X axis value is in seconds and an ‘Integration Length’ of 1 would mean the ‘Integration Length’ was 1 second. Where the ‘Interval Style’ is ‘Points’ and an ‘Integration Length’ of 1 would mean the ‘Integration Length’ was 1 point on the X axis.

In this example the ‘Integration Length’ has been set to 0.9 seconds and the ‘Output Interval Step’ is set to 0.4 seconds.

The ‘Output Interval Step’ is the amount the integration moves on the x axis.

So in this example, the first 0.9 seconds are used to calculate the first value of the average. Then the next value calculated uses data from 0.4 seconds to 1.3 seconds, the next point would be 0.8 to 1.7 seconds and so on. The resulting moving average is shown in Figure 5.

Resulting moving average
Figure 5: Resulting moving average
The following two tabs change content below.

James Wren

Former Sales & Marketing Manager at Prosig
James Wren was Sales & Marketing Manager for Prosig Ltd until 2019. James graduated from Portsmouth University in 2001, with a Masters degree in Electronic Engineering. He is a Chartered Engineer and a registered Eur Ing. He has been involved with motorsport from a very early age with a special interest in data acquisition. James is a founder member of the Dalmeny Racing team.

This Post Has 3 Comments

  1. David Ensor

    Good explanation. One comment/question. When comparing with original signal, is the first averaged point set at 0 seconds, 0.45 seconds, 0.4 seconds or ?? what. In other words is the new signal offset due to the window average.

    1. Prosig

      Hello David. The first point is at the mid-point of the integration length (so 0.9/2 = 0.45 in this case) it then moves by the step (0.4) and so subsequent points are at 0.85, 1.25, 1.65 and so on.

      1. David Ensor

        This is case for a number of software algorithms. But can cause downstream data handling problems. For instance the averaged signal will now have fewer points, possibly not in synch (depending on average window sizes and overlaps). So how does software, or defaults, work on subsequent multi channel processes – subtraction, division, or cross plotting for instance. Surely all other associated channels should be manipulated to keep synchronicity of points. Or does your software handle this. (It is often handled in different ways with other software tools – for instance reviewing all other channels and setting parameters to suit).

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.