Exponentially weighted moving average (EWMA) standard deviation applies different weights to different returns. More recent returns have greater weight on the variance. The exponentially weighted moving average (EWMA) introduces lambda, called the smoothing parameter. Lambda must be less than one.
Lorenzo Brancali (2020). EWMA St.Dev. (https://www.mathworks.com/matlabcentral/fileexchange/35539-ewma-st-dev), MATLAB Central File Exchange. Retrieved .
Sorry, because it is not a note written in English, it is impossible to understand.
Correct me if I am wrong but this code appears to have an error.
Assume d = 0.94. When i = 1, which corresponds to the most recent observation, d^i-1 = 1.0. The product of d^i-1*(1-d) which yields 0.06 should be applied to the squared return (subtract mean zero) of the most recet observation. However, with X(t-1, :) in your formula above, d^i-1*(1-d) for i = 1 is in fact applied to the next most recent observation.
Perhaps my explanation is not very clear but fundamentally when you supply say 20 returns to the formula, you shouldnt compute against 20-1 observations.