### Calculation

### Experimental Time Series

### Real Time Series

### C++-Source

```
BOOL ema (
vector<double>& ivec, // input vector
vector<double>& ovec, // output vector
unsigned long span) // time period or span of embedding
{
ULONG x = 0;
ULONG e = ivec.size();
double se = 2.0 / ((double)span + 1.0);
double le = 1.0 - se;
if ( span == 0 || span >= e )
return false;
ovec.resize(ivec.size());
ovec[0] = ivec[0];
for ( x = 1; x < e; x++ )
ovec[x] = ivec[x] * se + ovec[x-1] * le;
return true;
}
```