Đang tải... (xem toàn văn)
This report introduces 2 experiments on the TMS320C5515 eZDSPTM USB Stick Development Tool for performing a convolution of two vectors and generate a given signal. We calculated yn from given xn and hn for problem 1. The report also includes a hardwavebased programming and Matlabbased demonstration.
VIETNAM NATIONAL UNIVERSITY – HO CHI MINH CITY HO CHI MINH UNIVERSITY OF TECHNOLOGY ELECTRICAL & ELECTRONICS FACULTY -o0o - Digital Signal Processing Lab Report of Lab Convolution & Squarewave Generation TMS320C5515 eZDSPTM USB Stick GROUP Student: Tran Nguyen Khang ID: 1651047 In-class ID: 30 Student: Tran Minh Khoa ID: 1651056 In-class ID: 31 Page Abstract This report introduces experiments on the TMS320C5515 eZDSPTM USB Stick Development Tool for performing a convolution of two vectors and generate a given signal We calculated y[n] from given x[n] and h[n] for problem The report also includes a hardwave-based programming and Matlab-based demonstration Problem 1: Write a program to calculate y(n) = x(n) * h(n) (A filter) Given x(n) = {-3, 2, 1, 0, 2, 3, -3,2} h(n) = {-1, -2, 3, 1, 2} Determine the filter’s order and realize the block diagram of the filter Problem 2: Generate a square wave input signal from an external function generator (f=200Hz) and internal generator (C5515/35) then calculate/sketch the output Introduction Convolution is a mathematical operation used to express the relation between input and output of an LTI system It relates input, output and impulse response of an LTI system as y(t)=x(t)∗h(t) Where y (t) = output of LTI x (t) = input of LTI h (t) = impulse response of LTI TRAN MINH KHOA 1651056 TRAN NGUYEN KHANG 1651047 Page We use Matlab and CCS to compute the output y[n] With the result sequence y[n], we will display it on a LCD 96×16 monochrome OLED display screen and check this result with the performance on MATLAB The sequence y[n] is equal to the convolution of sequences x[n] and h[n]: x[n] is input signal and h[n] is impulse response, in this project we have: x[n] = [-3, 2, 1, 0, 2, 3, -3, 2] h[n] = [-1, -2, 3, 1, 2] Figure Block Diagram Matlab can be used as an External Function Generator and TMS320C5515 can be used as Internal Generator TRAN MINH KHOA 1651056 TRAN NGUYEN KHANG 1651047 Page Q1: Matlab code %library; x = [-3 2 -3 2]; nx = [0 7]; h = [-1 -2 2]; nh = [0 4]; %y = conv(x,h) %Matlab provides a convolution function already [x11,n11] = sigshift(x,nx,1); %x(n-1) [x12,n12] = sigshift(x,nx,2); %x(n-2) [x13,n13] = sigshift(x,nx,3); %x(n-3) [x14,n14] = sigshift(x,nx,4); %x(n-4) %[x12,n12] = sigshift(x,n,-2); [y1,n1] = sigadd(-2*x11,n11,3*x12,n12); %-2x(n-1) + 3x(n-2) [y2,n2] = sigadd(x13,n13,2*x14,n14); %x(n-3) + 2x(n-4) [y2,n2] = sigadd(y2,n2,-x,nx); %-x(n) + x(n-3) + 2x(n-4) [y1,n1] = sigadd(y2,n2,y1,n1) %-x(n) -2x(n-1) + 3x(n-2) + x(n-3) + 2x(n-4) Firter_order = length(h) stem(n1,y1) %convolution; function [x,n] = imp(n0,n1,n2) n = [n1:n2]; x = [(n - n0) == 0]; end function [x,n] = stepseq(n0,n1,n2) n=[n1:n2]; x = [(n-n0) >= 0]; end function [y,n] = sigfold(x,n) y=fliplr(x); n = -fliplr(n); end function [y,n] = sigmult(x1,n1,x2,n2) n=min(min(n1),min(n2)):max(max(n1),max(n2)); y1 = zeros(1,length(n)); y2 = y1; y1(find((n>=min(n1))&(n=min(n2))&(n=min(n1))&(n=min(n2))&(n