Cancel
Showing results for 
Search instead for 
Did you mean: 

Exponential Smoothing formula

Pioneer
Pioneer

Hello,

 

I am trying to implement an exponential smoothing formula seen in the image attached.

 

This code is giving me the error "Addressing by index is only possible for lists, arrays or objects with a capacity >1"

 

a := 0.1;    --specify 0.1, 0.5, 0.9  
 j := 0;
 k := 0;   
 t := tblYDim.YDim; 
 z := tblYDim.YDim;
 b := 0;

 if z>1 then
  for k := 0 to t-1 loop
   b := t-k;
   j:= tblYDim.YDim[1,b];
   x:= round(j/100);
   Q := Q + round(pow(a*(1-a),k)*x); --Exponential smoothing (a(1-a)^0)*xt + (a(1-a)^1)*xt-1 ... 
   z := z - 1;
  next; 
  end;

 

The values for x are the values stored in tblYDim. I am not sure how to correct this error?

 

1 REPLY

Re: Exponential Smoothing formula

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
yDim don't accept an index

if you want to read the entry in row b, than you need only:

j:= tblYDim[1,b];
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net