Friday 22 November 2013

C program to perform circular convolution in CCS studio

           CCS,code composer studio is a integrated development environment for developing applications for Texas instruments embedded processors.I would like to write blogs which contains programs in C language or of MATLAB code.The reason is simple,I have a subject called Digital signal processing laboratory.It contains totally 24 programs and in exam we need to write just two,so some programs which I like out of the remaining ones I would like to write them in my blogs.
          C program :
#include<stdio.h>
int m=6,n=6,i=0,j;
int x[15]={1,2,3,,4,5,6,0,0,0,0,0,0,0};
int h[15]={1,2,3,,4,5,6,0,0,0,0,0,0,0};
 int y[20];
main()
{
     for(i=0;i<m+n-1;i++)
      {
            y[i]=0;
            for(j=0;j<=i;j++)
            y[i]+=x[i]*h[i-j];
}
     for(i=0;i<m+n-1;i++)
      printf("%d\n",y[i]);
}

2 comments: