I have a code for forecasting the 11th data based on the first 10 data by "exponential smoothing".
Now I want to modify this code to estimate NaN values in matrix z_new with the same method based on historical data.
I do not know how to relate these two problems. Can u help me?
Here is the original code.
z=[1,5,7,4,3,9,2,6,8,0]
n=length(z);a=[0.9 ];
yi1=[];
yi1(1)=NaN;
yi1(2)=z(1);
for i=3:11
yi1(i)=a(1)*z(i-1)+(1-a(1))*yi1(i-1);
end
RMSE1=...
sqrt((1/(n-1)*sum((z(2:end)-yi1(2:10)).^2)));
RM=[NaN,NaN,RMSE1];
i=1:11;
fprintf('\ti\t\tYi\t\t\tY^i(0.9)\n')
t=[i;z,NaN;yi1]';
t=[t;RM];
disp(t)
hold on
plot(i(1:10),z,'o:')
plot(i(2:11),yi1(2:11),'*g-')
legend('actual values','forecast:0.9')
hold off
% Now, how to estimate NaN in z_new with the same concept?
% z_new=[1,5,7,4,NaN,9,2,6,8,NaN]