Nishit, Amit and Blessy

At first, thank you for your quick reply!

I suppose that my problem about input signal wasn't enough clear. In the
meantime I managed to solve it by avoiding to use input signal at all and
therefore partly using solution that Nishit suggested.

I'm sending now how this look like.

Thanks again.

Regards,

Miljana!

%Generating autocorrelation function according to AR(p) model

eps=0.000000001;

fmP;

fs00;

N 0;

%Generating autocorrelation function according to Jakes' model

for p=1:N

vector(p)sselj(0,2*pi*fm*(p-1)/fs);

end

%Generating Toeplitz Matrix

%P is model order

%Adding a small bias, eps, to the autocorrelation matrix to overcome

...the ill conditioning of Yule-Walker equations

autocorr_mat=toeplitz(vector(1:P))+eye(P)*eps;

AR_parameters=-inv(autocorr_mat)*vector(2:P+1)';

%Generating autocorrelation function

autocorr_ar(1:P+1)=vector(1:P+1);

for k=P+2:N

s=0;

for m=1:P

s=s-AR_parameters(m)*autocorr_ar(k-m);

end

end

plot([0:N-1]',autocorr_ar);