s=tf('s'); wc=2.5/(0.8*s+1); wd=c2d(wc,0.01,'tustin') %b(1)=0.003322; b(2)=0.003322; b=cell2mat(get(wd,'num')); a=cell2mat(get(wd,'den')); %a(1)=1; a(2)=-0.9934; Ts=0.01;T=1000; t=0 : Ts : T; x1=randn(1,length(t)); x=0.01*x1; y=filter(b,a,x); R=xcorr(y); tau=-15+Ts :Ts : 15; lt=length(tau); s1r=round(length(R)/2-lt/2); s2r=round(length(R)/2+lt/2-1); plot(tau,R(s1r:s2r)),grid tau=[ 0 1 2 3 4 5 6 8 10 12 15]; %Rx=[0.3744 0.097 0.026 0.006 0.0025 0.0005 0.0003 0.0006 -0.0005 -0.0014 0]; %Rx=[0.031 0.017 0.0095 0.006 0.0025 0.0005 0.0003 0.0006 -0.0005 -0.0014 0]; %x=[-15 -12 -10 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 10 12 15]; %y=[0 -0.00014 -0.0005 0.0003 0.0005 0.0025 0.006 0.0095 0.017 0.031 0.017 0.0095 0.006 0.0025 0.0005 0.0003 0.0006 -0.0005 -0.0014]; %stem(x,y),grid; %hold on %plot(x,y)