-
FlexPro
- At a Glance
- Features & Options
- Applications
- All Advantages
- What’s New in FlexPro 2021
- Try FlexPro For Free
- FlexPro View OEM Freeware
- Buying Guide
- Login
- Language
- +49 6894 929600
- infoweisang.com
- Google Maps
- Products
- News
- Support
- Company
- Contact
- Login
- Language
- +49 6894 929600
- infoweisang.com
- Google Maps
Speeding up running average calculations
Home > Community > Automation and VBA > Speeding up running average calculations
- This topic has 3 replies, 2 voices, and was last updated 20 years, 9 months ago by norbert.bakkers@lr.org.
-
AuthorPosts
-
February 18, 2004 at 8:53 pm #12439norbert.bakkers@lr.orgParticipant
During execution of a programme, the running average of a dataset seems to take a very long time to calculate.
I first tried to get the code to program a running average by recording a macro and to use it in a modified form in my own code. The problem is that I can record it but I can not execute the macro. It crashes on the line that sets the ‘Interval width’ => ‘WindowSize’.
This is the recorded macro:
ActiveDatabase.ActiveFolder.Object(“Mean”).Select False
ActiveDatabase.ActiveFolder.Object(“Mean”).Select
ActiveDatabase.SelectedObject.WindowSize = 500
Application.UpdateAllTherefore I use the following formula:
.Formula = “Mean(‘DataSet’ ,MEAN_ARITHMETIC + CALC_RUNNING, 500)”This works but is very slow for bigger datasets, especially if the averaging window is big. Is there any way of speeding up this process?
February 18, 2004 at 11:57 pm #8734Bernhard KantzParticipantThe macro stops with an error because the generated code is not correct. We will remove this issue. The correct code should be:
ActiveDatabase.SelectedObject.SmoothingWidth = 500
An alternative to the mean function is the smooth function respectively the Signal Smoothing Analysis Object. This method uses a faster linear algorithm.
The result ofMean('DataSet' ,MEAN_ARITHMETIC + CALC_RUNNING, 501)"
and
Smooth('DataSet' ,250)"
is similar.
When the smoothing is calculated, there are insufficient left and right neighbours available for the first or last SmoothingWidth values in DataSet. Unlike the mean function these values are then equated to the first or last value in DataSet.Refer to the online help for more information.
February 19, 2004 at 2:10 am #8735norbert.bakkers@lr.orgParticipantThanks.
Using the Smooth function instead of the running average function speeds the process up by almost a factor of 10 !!February 19, 2004 at 2:20 am #8120norbert.bakkers@lr.orgParticipantDuring execution of a programme, the running average of a dataset seems to take a very long time to calculate.
I first tried to get the code to program a running average by recording a macro and to use it in a modified form in my own code. The problem is that I can record it but I can not execute the macro. It crashes on the line that sets the ‘Interval width’ => ‘WindowSize’.
This is the recorded macro:
ActiveDatabase.ActiveFolder.Object(“Mean”).Select False
ActiveDatabase.ActiveFolder.Object(“Mean”).Select
ActiveDatabase.SelectedObject.WindowSize = 500
Application.UpdateAllTherefore I use the following formula:
.Formula = “Mean(‘DataSet’ ,MEAN_ARITHMETIC + CALC_RUNNING, 500)”This works but is very slow for bigger datasets, especially if the averaging window is big. Is there any way of speeding up this process?
-
AuthorPosts
- You must be logged in to reply to this topic.