Hinweis:Dieser Abschnitt ist nur in englischer Sprache verfügbar. Wir bitten um Ihr Verständnis.
3.5.2.55 Wmovavg
Contents
Description
This function is for calculating weighted moving averages. At point = i, the weighted moving average value is:
where
is the weighted value and
is the length of vector vw.
Syntax
dataset wmovavg(dataset vd, dataset vw[, int method])
Parameters
vd
- The data vector is used to calculate weighted moving average.
vw
- The weight vector is used to weighted the data of interest.
method(2025b)
- Optional. Determine which method to use.
- method = 0 the fast method, old behavior.
- method = 1 the robust method sorts data in a special way then applies the sum-divide algorithm.
Return
Return the weighted moving average vector.
Example
// Col(3) will be filled with weighted moving average value at each point, //with stating point = 10. for(ii=1;ii<=30;ii++) col(1)[ii] = ii; //data vector for(ii=1;ii<=10;ii++) col(2)[ii] = ii/10; //weight vector col(3)=wmovavg(col(1),col(2));