Pages

Friday, December 10, 2010

MATLAB PROGRAM FOR AUTO-CORRELATION (DIGITAL SIGNAL PROCESSIING)


clear all;
x=input('enter the sequence x=');
N=length(x);
y=x;
z=x;
for i=1:N-1
    for i=N-1:-1:1
        x(i+1)=x(i);
    end
    x(1)=0;
    z=[z; x];
end;
m=[z]*[y'];
m=m/N
stem(m);
title('auto-correlation');
xlabel('time index');
ylabel('amplitude');

2 comments:

  1. Does this even work? I think there is a typo here
    for i=1:N-1
    for i=N-1:-1:1
    How can you have a nested for loop using the counter variable (i)?

    ReplyDelete