Anda di halaman 1dari 12

Ho Chi Minh University of Technology

DIGITAL SIGNAL PROCESSING MINOR LAB 4 REPORT

DFT/ FFT Using TMS320C5515 TM eZDSP USB Stick


via CCS and Matlab

Instructor: Prof. Thuong Tien-Le


Group 11
Student’s name: Hoàng Phan Trung
ID: ILI13212
Table of contents
 Table of contents
 Abstract
 Introduction
 Flow chart
 Code
 Result
 Conclusion
 Reference
Abstract

This report outlines steps to generate and calculate DFT/FFT


of a given signal using TMS320C5515 eZDSPTM USB Stick
Development Tool. The report includes a Matlab-based
demonstration and hardware-based programming.
Introduction
In mathematics, the discrete Fourier transform (DFT) is a specific kind of Fourier transform,
used in Fourier analysis. It transforms one function into another, which is called the frequency
domain representation, or simply the DFT, of the original function (which is often a function in
the time domain). In DFT, both input and output are discrete (i.e. discrete in time domain and
frequency domain).
The input to the DFT is a finite sequence of real or complex numbers , making the DFT ideal for
processing information stored in computers.
The sequence of N complex numbers is transformed into an N-periodic
sequence of complex numbers:
N−1

Xk = ∑ xn . e−2πkn/N , 𝒌 ∈ 𝒁
0

The DFT can be computed efficiently in practice using a fast Fourier transform (FFT) algorithm.
FFT algorithms are so commonly employed to compute DFTs that the term "FFT" is often used
to mean "DFT" in colloquial settings. Formally, there is a clear distinction: "DFT" refers to a
mathematical transformation or function, regardless of how it is computed, whereas "FFT"
refers to a specific family of algorithms for computing DFTs.
In this lab session, we will generate and calculate 128-DFT of the following signal:
x(t)=-2 cos(400πt) + cos(200πt) - 1.5cos(600πt)
Using Matlab, TMS320C5515 eZDSPTM USB Stick Development Tool. The signal is also generated
by VIRTIN Multi-Instrument 3.2. Then, the results of Matlab and C5515 are compared.
FLOW CHART
Calculate 4-DFT/FFT in IC

We have the result of calculation DFT/FFT by hand:


CODE
1. Code for CSS:
#include "stdio.h"
#define max_x 100
#define max_h 100 #define max_y 200
void main( void )
{
int l;
printf("Waiting for matlab\n"); while(freopen("kk.c","r",stdin)==NULL ){}
freopen("aa.c","r",stdin); // read from file float
result_real[4],result_image[4],x1[4]; float x[100];

int i,n,j;
scanf("%d",&n); // range of x for (i=0; i<n ;i++ ) scanf("%f",&x[i]);
for (i=0; i<4 ;i++ )
{
x1[i]=0;
for (j=0 ;j<3 ;j++ )
{
x1[i]=x1[i]+x[i+4*j];
}
}
result_real[0]=x1[0]+x1[1]+x1[2]+x1[3]; result_real[1]=x1[0]-x1[2];
result_real[2]=x1[0]-x1[1]+x1[2]-x1[3]; result_real[3]=x1[0]-x1[2];
result_image[0]=0;
result_image[1]=-x1[1]+x1[3]; result_image[2]=0;
result_image[3]=x1[1]-x1[3]; for (i=0;i<4 ;i++ ) {
printf("%f %fi\n",result_real[i],result_image[i]);
}
freopen("result.txt","w",stdout); for
(i=0;i<4 ;i++ )
{
printf("%f\n%f\n",result_real[i],result_image[i]);
}
fclose(stdout);
}

2. Code on matlap:
n=12;
fileID = fopen('kk.c','w');
fclose(fileID);

fileID = fopen('aa.c','w');
fprintf(fileID,'%d\n',n);
for i=0:1:3
fprintf(fileID,'%f ',i*2);
end
for i=4:1:9
fprintf(fileID,'%f ',(i*i)./4);
end
fprintf(fileID,'%f ',0);
fprintf(fileID,'%f ',0);
fclose(fileID);
while fopen('result.txt','r')==-1
end
fileID=fopen('result.txt','r');
fclose(fileID);
fileID=fopen('result.txt','r');
A=fscanf(fileID,'%f')
figure;
hold on;
grid on;
for x=1:2:7
stem( A(x),A(x+1),'r*');

end
xlabel('real');
ylabel('imaginary');
fclose(fileID);
Result
We have the result on CCS like that:

And after we connect to matlab we have the result like that


Conclusion
We have the result for this project. But the result on CCS also need signal from
matlab. This project help me to understand more detail about DFT/FFT.
REFERENCES

1. Texas Instruments, C5515 eZDSP USB Stick Development


Tool description and features,
http://www.ti.com/tool/tmdx5515ezdsp, retrieved on
February, 27th 2014.
2. sensorasia, TMS320C5515_eZdip_USB stick.MP4,
http://www.youtube.com/watch?v=ZFnvH1iZoY8, retrieved
on February, 27th 2014.
3. Definition are taken from

https://en.wikipedia.org/wiki/Discrete_Fourier_transform

Definition are taken from

https://en.wikipedia.org/wiki/Fast_Fourier_transform

Anda mungkin juga menyukai