AUTO CORRELATION

//AUTO CORRELATION
#include<iostream.h>
#include<conio.h>
void main()
{
int i=0,j=0,k,m,n,r;
cout<<“Auto Correlation”;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<“enter m”;
cin>>m;
n=m;
r=m+n-1;

int x[10],z[10],y[10];
for(i=0;i<=10;i++)
{ z[i]=0;
y[i]=0;
x[i]=0;
}
cout<<“enter input matrix”;
for(i=0;i<m;i++)
{
cin>>x[i];
}

cout<<“the input matrix is x[n]=”;
for(i=0;i<m;i++)
{
cout<<x[i]<<“,”;
} cout<<endl;

 

//reverse 2nd array
for(i=0,j=n;i<=n;i++,j–)
{
z[j-1]=x[i];
}

cout<<“the reversed impulse matrix is h[n]=”;
for(i=0;i<n;i++)
{
cout<<z[i]<<“,”;
} cout<<endl;

for(i=0;i<=r;i++)
{ for(k=0;k<=i;k++)
{
y[i]+=x[k]*z[i-k];
}
}

cout<<“the op matrix is y[n]=”;
for(i=0;i<r;i++)
{
cout<<y[i]<<“,”;
}

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s