**AIM: - To develop program for discrete correlation**

**PROGRAM: -**

%Program for computing cross correlation of the sequences x=[1,2,3,4] and h=[4,3,2,1]

clc;

clear all;

close all;

x=input('enter the 1st sequence');

h=input('enter the 2nd sequence');

y=xcorr(x,h);

figure;

subplot(3,1,1);

stem(x);

ylabel('Amplitude-->');

xlabel('(a)n-->');

subplot(3,1,2)

stem(h);

ylabel('Amplitude-->');

xlabel('(b)n-->');

subplot(3,1,3)

stem(fliplr(y));

ylabel('Amplitude');

xlabel('(c)n-->');

disp('The resultant signal is');

fliplr(y)

Output: - |

enter the 1st sequence[1 2 3 4]

enter the 2nd sequence[4 3 2 1]

The resultant signal is

ans =

16.0000 24.0000 25.0000 20.0000 10.0000 4.0000 1.0000

## No comments:

## Post a Comment