To Convolve 2 arrays using DSP controller

SOFTWARE USED: Code Composer Studio

HARDWARE REQUIRED: DSP controller board (TMS320F28335), JTAG, XDS100V2 board

THEORY:

Convolution is a mathematical operation on two functions (f and g) that produces a third function expressing how the shape of one is modified by the other.

The term convolution refers to both the result function and to the process of computing it. It is defined as the integral of the product of the two functions after one is reversed and shifted. Also, we have one more important property that convolution in time domain is multiplication In frequency domain.

We can write convolution as:

CODE for Sine Wave:

#include <stdio.h>

#include <math.h>

int i,j,m=5,n=3,y[7];

int x[7]={1,2,3,4,5};

int h[7]={1,2,3};

void main()

{

    for(i=m;i<=m+n-1;i++)

 

        x[i]=0;

    for(i=n;i<=m+n-1;i++)

 

            h[i]=0;

 

 

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

{

y[i]=0;

for(j=0; j<=i;j++)

{

    y[i]=(x[j]*h[i-j])+y[i];

}

}

 

}

Output:

 

y      x

1

2

3

4

5

1

 

 

1

2

3

4

5

2

2

4

6

8

10

3

3

6

9

12

15

Output= (1), (2+2=4), (4+3+3=10), (6+6+4=16), (9+8+5=22), (12+10=22), (15)


Post a Comment

Please do not enter any spam links in the comments...

Previous Post Next Post