movavg function produces incorrect values


Version: 2025b

Type: Features

Category: Programming

Subcategory: LabTalk

Jira: ORG-30721


When input data’s scale is large, the movavg function will procedure a incorrect result.

The original metod is fast especially for a large window size, and avoids overflow. But in some cases, it may lose precision like when data scale is large.

Now a new parameter method is added, default is 0.

  • Movavg(A, 2, 2, 0, 0): the fast method works as it did.

  • Movavg(A, 2, 2, 0, 1): the robust method sorts data in a special way then applies the sum-divide algorithm.

This new parameter also adds to the tmovavg and wmovavg functions. The emvoavg and mmovavg functions also improve to use the robust method by default.