%  this program is use to generate ar model data from phi and sigma.

function ardata=m5346ardatagenerate(phiar,sigmaar,datalength)

%function ardata=ardata_generate(phiarma,sigmaarma,datalength)

norder=length(phiar);
n=sigmaar*randn([datalength 1]);
ardata=zeros([datalength 1]);

%***********************************
for k=(norder+1):length(ardata)  % time loop
   ardata(k)=phiar'*ardata( (k-1):-1:(k-norder))+n(k);
 end  % end of time k loop


