Pages

Friday, 22 February 2013

Auto Correlation Without Using Function (Matlab2012a)

Program:

clc;
clear all;
x = input('Enter the sequence = ');
N = length(x);
a = 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 = [x;z;x];
end
k = z*y';
m = k';
subplot(2,1,1);
stem(a);
title('Input Sequence');
ylabel('Amplitude---->');
xlabel('n---->');
grid on;
subplot(2,1,2);
stem(m);
title('Autocorrelation Sequence');
ylabel('Amplitude---->');
xlabel('n---->');
grid on;
disp('Auto Correlation Sequence = ');
disp(m);


Output:

Enter the sequence = [1 2 3]
Auto Correlation Sequence =
     3     8    14     8     3


Waveform:

No comments:

Post a Comment