clear;
N=1024;
% ar_modelMA process generating
ar_model(1)=0.5*randn(1);
ar_model(2)=0.9*ar_model(1)+0.5*randn(1);

for (i=3:1:N)
    ar_model(i)=0.9*ar_model(i-1)-0.7*ar_model(i-2)+0.5*randn(1);
end;

k=1:N;
plot(k,ar_model)

signal_centered=ar_model-mean(ar_model);

for(tau=1:1:N)
 acf(tau)=0;
 for(j=1:1:N-tau)
    acf(tau)=acf(tau)+signal_centered(j)*signal_centered(j+tau-1);
 end;
  acf(tau)= acf(tau)/(N-tau+1);
end;
plot(acf);

dT=1;

 [spectr, omega] = ampl_fft(acf,dT)

 plot(omega/2/pi,abs(spectr))
 %frequency,   amplitude spectr
 