function [I,X]=synth (x0,Ymean,Ahat,Bhat,Chat,tau)

[n,nv]=size(Bhat);
k=10;
tolr = 0.0000000;
X(:,1)=x0;
for t=1:tau
    X(:,t+1)=Ahat*X(:,t)+Bhat*randn(nv,1);
    %I(:,t)=Chat*X(:,t)+((Chat*X(:,t))==tolr).*Ymean;
       I(:,t)=Chat*X(:,t)+Ymean;

end;
end
