Computation of N- Point  DFT of a given sequence using TMS320C67XX/TMS320C6713 kit

Aim:To find the impulse response using TMS320C67XX/TMS320C6713 KIT

SOFTARE REQUIREMENTS:

Operating System – Windows XP

Constructor - Simulator

Software – Code Composer Studio3.1v,  6713DSK Diagnostics.

HARDARE REQUIREMENTS:

TMS320C6713DSP KIT  

USB cable  

Power Supply +5v 

Program:

#include<stdio.h>  
#include<math.h>  

void main()  
{  
short N = 8;  
short x[8] = {1,2,3,4,5,6,7,0}; // test data float pi = 3.1416;  
float sumRe = 0, sumIm = 0; // init real/imag components  
float cosine = 0, sine = 0; // Initialise cosine/sine components  

// Output Real and Imaginary components  

float out_real[8] = {0.0}, out_imag[8] = {0.0}; int n = 0, k = 0;  

for(k=0 ; k<N ; k++)  
{  
sumRe = 0;  
sumIm = 0;  
for (n=0; n<N ; n++)  
{  
cosine = cos(2*pi*k*n/N);  
sine = sin(2*pi*k*n/N);
sumRe = sumRe + x[n] * cosine;  
sumIm = sumIm - x[n] * sine;  }  

out_real[k] = sumRe;  
out_imag[k] = sumIm;  
printf("[%d] %7.3f %7.3f \n", k, out_real[k], out_imag[k]);
}
}

Output  

[0] 28.000 0.000

[1] -9.657 4.000

[2] -4.000 -4.000

[3] 1.657 -4.000

[4] 4.000 -0.000

[5] 1.657 4.000

[6] -4.000 4.000

[7] -9.657 -3.999

 

Verification in matlab  

x = [1,2,3,4,5,6,7,0] fft(x)  

Output  

Columns 1 through 4  

28.0000 -3.5000 + 7.2678i -3.5000 + 2.7912i -3.5000 + 0.7989i

Columns 5 through 7

-3.5000 - 0.7989i -3.5000 - 2.7912i -3.5000 - 7.2678i