# Wmovavg

Wmovavg-func

## 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)

## Parameters

**vd**

- The data vector is used to calculate weighted moving average.

**vw**

- The weight vector is used to weighted the data of interest.

## 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));