MATLAB Program for Cross Correlation for the given sequences | IT1254 - DSP and Communications Systems Lab


AIM:
        To write a program for Cross Correlation for the given sequences using MATLAB in IT1254 - DSP and Communications Systems Lab.

ALGORITHM:
Step 1: Start
Step 2: Read the first input sequence
Step 3: Read the second input sequence
Step 4: Perform cross correlation using the xcorr() function
Step 5: Plot the sequences
Step 6: Display the input & output sequences
Step 7: Stop

SOURCE CODE:
clc;
clear all;
close all;
x=input('Enter the sequence 1: ');
h=input('Enter the sequence 2: ');
y=xcorr(x,h);
figure;
subplot(3,1,1);
stem(x);
xlabel('n->');
ylabel('Amplitude->');
title('Input sequence 1');
subplot(3,1,2);
stem(fliplr(y));
stem(h);
xlabel('n->');
ylabel('Amplitude->');
title('Input sequence 2');
subplot(3,1,3);
stem(fliplr(y));   
xlabel('n->');
ylabel('Amplitude->');
title('Output sequence');
disp('The resultant is');
fliplr(y);

OUTPUT:
Click to view full size image!

RESULT:
  Thus the program for auto correlation of a given sequence was calculated and the output was displayed.

Previous
Next Post »

If you still didn't find what you're looking for, you can search this website below: