DSP lab5 report Bach Khoa

23 137 0
DSP lab5 report Bach Khoa

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Generate and calculate DFT of a periodic signalUsing TMS320C5515 eZDSPTM USB StickAssoc. Prof. Dr. Thuong Le TienThis report outlines steps to generate and calculate 128 DFT of a given signal using TMS320C5515 eZDSPTM USB Stick Development Tool. The report includes a Matlabbased demonstration and hardwarebased programming. The two outcomes are also analyzed and compared.

Vietnam National University Ho Chi Minh City University of Technology Digital Signal Processing LAB REPORT Generate and calculate DFT of a periodic signal Using TMS320C5515 eZDSPTM USB Stick Instructor: Assoc Prof Dr Thuong Le -Tien Teaching Asisstants: Chi Hieu, Quoc Huy Group 7: Dat Nguyen-Si ID: ILI11006 In-class ID: Trung Le ID: 41103857 In-class ID: April, 24th 2014 April, 24th 2014 Adventure Works Marketing Plan Lab report Table of Contents [Type text] Page April, 24th 2014 Adventure Works Marketing Plan Lab report Abstract This report outlines steps to generate and calculate 128 - DFT of a given signal using TMS320C5515 eZDSPTM USB Stick Development Tool The report includes a Matlab-based demonstration and hardware-based programming The two outcomes are also analyzed and compared [Type text] Page April, 24th 2014 Adventure Works Marketing Plan Lab report 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 sequence of complex numbers: is transformed into an N-periodic 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 [Type text] Page April, 24th 2014 Adventure Works Marketing Plan Lab report Matlab implementation I)FLOW CHART Start Start Generate Generate x(t) x(t) Sketch Sketch x(t) x(t) Take Take 128-DFT 128-DFT Sketch Sketch X(f) X(f) Save Save signal signal data data End End [Type text] Page April, 24th 2014 Adventure Works Marketing Plan Lab report II)MATLAB CODES clc; close all; clear all; % generate 128 signal samples with Fs=1000Hz t=0:0.001:0.127; x=-2*cos(400*pi*t) + cos(200*pi*t) - 1.5*cos(600*pi*t); %sketch the signal figure(1); plot(t,x); ylabel('Amplitude'); xlabel('Time'); %take 128-FFT of the given signal X=fft(x,128); X=fftshift(X); %sketch the FFT f = (-64:63)*(1000/128); figure(2); stem(f,abs(X)); ylabel('Amplitude'); xlabel('Frequency'); %store the signal data samples = round(x); temp = zeros(1,256); for i = 0:127 temp(1+2*i) = samples(1+i); end samples = temp; id = fopen('D:\samples3.bin','wb'); fwrite(id, samples, 'int16'); fclose(id); [Type text] Page April, 24th 2014 Adventure Works Marketing Plan Lab report We have the follwong results: Signal result: FFT result: [Type text] Page April, 24th 2014 Adventure Works Marketing Plan Lab report The main frequencies ( 100 Hz, 200 Hz, 300 Hz) are shown correctly C5515 implementation I)FLOW CHART [Type text] Page April, 24th 2014 Adventure Works Marketing Plan Lab report Start Start Generate Generate x(t) x(t) Sketch Sketch x(t) x(t) Take Take 128-DFT 128-DFT Sketch Sketch X(f) X(f) Save Save signal signal data data End End II)SOURCE CODES Signal generation Flowchart: [Type text] Page April, 24th 2014 Adventure Works Marketing Plan 10 Lab report Start Start set set Fs=48Khz Fs=48Khz set set f1,f2,f3 f1,f2,f3 calculate calculate x(t) x(t) samples samples in in double double multiply multiply 1333 1333 to to the the samples samples for for greater-than-1 greater-than-1 values values Convert Convert them them into into intergers intergers Play Play the the signal signal End End We only modify the aic3204_tone_headphone module: #include "stdio.h" #include "usbstk5515.h" extern Int16 AIC3204_rset( Uint16 regnum, Uint16 regval); #define XmitL 0x10 #define XmitR 0x20 #define #define #define #define Fs 48000 F1 200 F2 100 F3 300 #define PI 3.141592654 #include "math.h" /* * * * * AIC3204 Tone * * Output a kHz tone through the HEADPHONE jack * * * */ Int16 aic3204_tone_headphone( ) { double * signal; short * ptsig; [Type text] Page 10 * April, 24th 2014 Adventure Works Marketing Plan 11 Lab report int x; int nsample = (Fs) / F2; signal = (double*) malloc( nsample * sizeof(double)); for ( x = 0; x < nsample; x++) { signal[x] = 1333*( -2*cos (2*PI*x*F1/Fs) + cos(2*PI*x*F2/Fs) 1.5*cos(2*PI*x*F3/Fs) ); } ptsig = (short*) malloc( nsample * sizeof(short)); for ( x = 0; x < nsample; x++) { ptsig[x] = (short) signal[x]; } /* Configure AIC3204 */ AIC3204_rset( 0, ); // Select page AIC3204_rset( 1, ); // Reset codec AIC3204_rset( 0, ); // Select page AIC3204_rset( 1, ); // Disable crude AVDD generation from DVDD AIC3204_rset( 2, ); // Enable Analog Blocks, use LDO power AIC3204_rset( 0, ); /* PLL and Clocks config and Power Up */ AIC3204_rset( 27, 0x0d ); // BCLK and WCLK are set as o/p; AIC3204(Master) AIC3204_rset( 28, 0x00 ); // Data ofset = AIC3204_rset( 4, ); // PLL setting: PLLCLK

Ngày đăng: 15/10/2020, 16:19

Mục lục

    Even so, the main frequencies are still the same:

    Compare the results and Conclusions

    Here are the 128-FFT done by C5515 and Matlab( respectively) :

Tài liệu cùng người dùng

Tài liệu liên quan