CORRELATION CONCEPT DSP C PROGRAM - Computer Programming

# Computer Programming

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

## Thursday, November 10, 2011

CORRELATION

AIM: To convert Circular Convolution

EQUIPMENTS

TEXAS TMS 320 C6713 Kit.
RS232 Serial Cable
Power Cord

THEORY:
Correlation is measures of the degree to which two sequences are similar .There are two types of Correlation 1. Cross correlation 2.Auto correlation
Cross Correlation:-   given two real valued sequences x1(n) of finite energy , the cross correlation of x1(n) and x2(n) is a sequence rxy  (1) defined as

rxy( 1 )=

#include<stdio.h>
int m,n,X,RXY,Y,i,j,temp,k,X2,a;
void main()
{
printf("enter the length of the first sequence\n");
scanf("%d",&m);
printf("enter the length of the second sequence\n");
scanf("%d",&n);
printf("enter the first sequence\n");
for(i=0;i<m;i++)
scanf("%d",&X[i]);
printf("enter the secound sequence\n");
for(j=0;j<n;j++)
scanf("%d",&Y[j]);
for(i=n;i<m+n-1;i++)
X[i]=0;

for(i=m;i<n+m-1;i++)
Y[i]=0;

if(m>n)
a=m;
else
a=n

for(l=0;l<a;l++)
{
RXY[l]=0;
for(n=0;n<a;n++)

{
RXY[l]+=X[n+l]*X2[n];
}
}
printf("the correlation is\n");
for(i=0;i<n;i++)
printf("%d\t",RXY[i]);
}

enter the length of the first sequence
5
enter the length of the second sequence
5
enter the first sequence
5,5,5,5,5,5
enter the secound sequence
5,5,5,5,5,5
the correlation is
125,100,75,50,25

OUTPUT: #### 1 comment:

1. code does not work idiot