# Untitled

unknown
matlab
a year ago
1.2 kB
1
Indexable
Never
    Ck = [  -y(t) -y(t-1) -y(t-10) -y(t-12) -y(t-22) -y(t-23) -y(t-24) h_et(t-1) h_et(t-12) h_et(t-13) h_et(t-22) h_et(t-23) h_et(t-24) ut(t-1) ];           % C_{t+1|t}
yk = Ck*xt(:,t);                            % \hat{y}_{t+1|t} = C_{t+1|t} A x_{t|t}

Ck2 = [  -yk -y(t) -y(t-9) -y(t-11) -y(t-21) -y(t-22) -y(t-23) h_et(t) h_et(t-11) h_et(t-12) h_et(t-21) h_et(t-22) h_et(t-23) ut(t) ];           % C_{t+1|t}
yk2 = Ck2*xt(:,t);                            % \hat{y}_{t+1|t} = C_{t+1|t} A x_{t|t}

% Note that the k-step predictions is formed using the k-1, k-2, ...
% predictions, with the predicted future noises being set to zero. If
% the ARMA has a higher order AR part, one needs to keep track of each
% of the earlier predicted values.
for k0=3:k
Ck = [ -yk2 -yk -y(t-11+k0) -y(t-13+k0) -y(t-23+k0) -y(t-24+k0) -y(t-25+k0) h_et(t-2+k0) h_et(t-13+k0) h_et(t-14+k0) h_et(t-23+k0) h_et(t-24+k0) h_et(t-25+k0) ut(t-2+k0)  ]; % C_{t+k|t}
yk = Ck*A^k*xt(:,t);                    % \hat{y}_{t+k|t} = C_{t+k|t} A^k x_{t|t}
end
yhatk(t+k) = yk;                            % Note that this should be stored at t+k.
%h_et_k(t+k) = y(t+k)-yhat(t+k);
end