CORRELATION CONCEPT DSP C PROGRAM - Code

Latest

programs

Thursday, November 10, 2011

CORRELATION CONCEPT DSP C PROGRAM


                               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[30],RXY[30],Y[30],i,j,temp[30],k,X2[30],a[30];
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:

















No comments:

Post a Comment