Chandu Dsp Manual
-
Upload
sumit-padhi -
Category
Documents
-
view
234 -
download
0
Transcript of Chandu Dsp Manual
-
7/31/2019 Chandu Dsp Manual
1/28
-
7/31/2019 Chandu Dsp Manual
2/28
EXPERIMENT No: 1
AIM OF THE EXPERIMENT: Working with a DSP processor( Fixed point-
TM320VC5416/ Floating point series)
APPARATUS REQUIRED : 1. Computer System with SP-2 OS.
2. Micro-5416 DSP kit3. Serial Cable- RS232
4. CRO
5. VI Debugger software.6. Code composer software
THEORY:
PROCEDURE:
PROCEDURE FOR MICRO-5416 PROCESSOR
This is the software where we can convert our ASM( assembly file) to ASC (ascii
code). Ten it will downloaded to the 5416 Kit. These are the steps to be followed.
1. Double click on the 5416 Debugger icon in the desktop.
2. When ever it open, it shows one massage like VI hardware found in COM-1.
It means your kit and PC are communicating with each other properly.
3. If it is not showing, click on serialmenu port setting Auto detect, before
that reset your 5416 kit.
4. In the project menu click on the New Project for creating a new project. Give
your name of project with the extension *.dpj if it is not available.
5. Then go to the file menu click on new file , in that click on asm file.
6. Then editor window will appear, in which we can type our asm file.
7. The alternative method is to copy your asm file to this location which is stored in
another location.
8. After typing the asm file save the file by clicking save option in file menu with
the extension *.asm.
-
7/31/2019 Chandu Dsp Manual
3/28
9. Then add the file to the project by clicking on the project menu then on add file
to project.
10.Do the same procedure to add the cmd file to project i.e Micro5416.cmd file.
11.Then select build from project menu. It is for building your asc file. If any error
occurs it shows in the error massage box below the asm file.
12.After successful built , it shows confirmation massage. Now your asc file is
created in the same folder as in the asm file.
13.Then browse your *.asc file and clickok.
14.After downloading the asc file go to serial menu click on communication
window.
15.In communication window substitute your input at a location given in asm file
by typing SD then press enter key.
16.you can enter multiple value one by one by pressing enter key.
17.To come out of it press dot(.) mark after the desired last location.
18.Then type GO 0000 , press enter key.
19.Then Reset your Kit, go to your output location by typing SD and enter key.
-
7/31/2019 Chandu Dsp Manual
4/28
PROCEDURE FOR CODE COMPOSER STUDIO
This software is used to convert the C code file to *.out file which will later
converted to asc file for downloading. After installing the CCS complier you will find
two icons in the desktop. (i) CCS 5000 (ii) Setup for CCS 5000
1. First click on Setup for CCS5000 icon , it will open a window in that select
Platform as 54 and type as Simulator. Then select the 5416 device simulator
and click Import. Now the 5416 device simulator was added to your system.
2. Then Select save &quit. It will ask for start of CCS compiler click ok. Then the
code composer studio will open automatically.
3. For creating a new project click the Project menu and select the new project, then
give the project name with the extension (*.pjt) click finish. The default directoryis c:\ ti\ myprojects.
4. For creating a new file click the file menu and click new and select the source file.
5. Type your c file in the editor window and save it by clicking save from file menu.
6. Then give the file name as *.c file and click save option.
7. Go to project menu select add file to the project and add your *.c file to the
project.
8. Do the same steps to add the cmd file to the project( MICRO5416.cmd).
9. After adding the *.c & *.cmd file , go to project menu click on the build option
for compile the project.
10.after successful compilation the *.out file is created in the default directory i.e
c:\ ti\ myprojects\*.pjt \debug\*.out.
11.Then open the 5416 debugger, in that click on tool convert *.out to *.asc
option.
12.Then click on browse, select your *.out file and convert . Then *.asc file is also
created in the same directory.
13.Then click on serial menu and select load program, browse for the *.asc file click
ok.
14.After downloading click on serial menu communication window for execution.
-
7/31/2019 Chandu Dsp Manual
5/28
15. In communication window substitute your input at a location given in c file by
typing SD then press enter key.
16.you can enter multiple value one by one by pressing enter key.
17.To come out of it press dot(.) mark after the desired last location.
18.Then type GO 0000 , press enter key.
19.Then Reset your Kit, go to your output location by typing SD and enter key.
-
7/31/2019 Chandu Dsp Manual
6/28
EXPERIMENT No: 02
AIM OF THE EXPERIMENT: Generation of Different types of signal (Both
Continuous and Discrete).
APPARATUS REQUIRED : 1. Computer System2. Matlab Software
THEORY:
PROCEDURE: 1. Click on the Matlab icon on the desktop.2. In the command window, clickon file menu New M file.
3. In edit window, Type the program as follows below.
4. Then press F5 to save and run the current file.
5. Click on the command window for any error.
6. Now the out can be viewed in the figure window.
PROGRAMME: 1
(A)Unit Step Sequence
1. N=21;2. n=0:1:N-1;3. x=ones(1,N);4. plot(x) % for continuous signal5. stem(x) % for Discrete signal
-
7/31/2019 Chandu Dsp Manual
7/28
-
7/31/2019 Chandu Dsp Manual
8/28
(C )Sinusoidal Signal
1. N=21;2. n=0:1:N-1;3. x=sin(0.1*pi*n);4. plot(x) % for continuous signal5. stem(x) % for Discrete signal
-
7/31/2019 Chandu Dsp Manual
9/28
(D) Addition of Two signals
1. N=21;2. n=0:1:N-1;3. x= sin(0.1*pi*n) + cos(0.1*pi*n);4. plot(x) % for continuous signal5. stem(x) % for Discrete signal
-
7/31/2019 Chandu Dsp Manual
10/28
(E) Exponential Signal
1. N=21;2. n=0:1:N-1;3. x=exp(n);4. plot(x) % for Continuous signal5. stem(x) % for Discrete signal
-
7/31/2019 Chandu Dsp Manual
11/28
Conclusion:
From the above experiment we have studied how different types of signal is generated by the
help of mat lab and the output graph is successfully plotted.
-
7/31/2019 Chandu Dsp Manual
12/28
EXPERIMENT No: 03
AIM OF THE EXPERIMENT: Linear Convolution of sequences( Without the help of Inbuilt
function CONV available in Matlab)
APPARATUS REQUIRED : 1. Computer System2. Matlab Software
THEORY:
Convolution is an important technique used in digital signal processing. It is a formal
mathematical operation, like addition, multiplication used to combine two signals to form a third
signal. Convolution relates the input signal, output signal and the impulse response. The impulse
response will be identity, delayed and attenuated or amplified version of the input impulse signal.
Basic concept of the DSP is the input signal decomposed into simple additive
components, each of these components passed through a linear system and the resulting output
components are added. When impulse decomposition is used, the procedure can be described by
a mathematical operation called convolution.
BASIC DIAGRAM:
Convolution is represented as shown in the figure below.
x[n]-------------- ------------------ y[n]
Linear systems relates input, impulse and output signal. An input signal, x[n] enters a linear
system and reacts with an impulse signal h[n] resulting an output y[n]. Convolution can also be
represented by the following equation
x[n] [n] = y[n]
N-1
It can also be defined as y[n] = x[k] h[n-k]
K=0
PROCEDURE: 1. Click on the matlab icon on the desktop.
LINEAR
SYSTEM
h[n]
-
7/31/2019 Chandu Dsp Manual
13/28
2. In the command window, click on file menu New M file.
3. In edit window, Type the program as follows below.4. Then press F5 to save and run the current file.
5. Click on the command window for any error.
6. Now the out can be viewed in the figure window.
PROGRAMME: 1. x= input(enter the 1stsequence); % x=[1 2 3 4]2. h=input(enter the 2ndsequence); % h=[2 3 4 5]3. n1=length(x)4. n2=length(h)5. n=n1+n2-16. H=zeros(n,n)7. x1= zeros(1,n)8. x1(1,1:n1)=x9. x1=x110.h1=h
11.H(1:n2,1)=h112.For c=2:1:n13.For r= 2:1:n14.H(r,c)= H(r-1,c-1)15.End16.End17.Y=H*x118.Y=Y19.Stem(Y)
CONCLUSION:From the above experiment it is clear that to find out the response of a signal when a
impulse is present.
-
7/31/2019 Chandu Dsp Manual
14/28
EXPERIMENT No: 04
AIM OF THE EXPERIMENT: Circular Convolution of sequences
APPARATUS REQUIRED : 1. Computer System
2. Matlab Software
THEORY:
In circular convolution it is necessary that the two sequences be of same length. It is similar tothe linear convolution except the scaling and shifting are performed in a circular fashion
equation for the circular convolution.
N-1
X3(m) = x1(n) x2((m-n))N m=0,1,2,3,N-1n=0
PROCEDURE: 1. Click on the matlab icon on the desktop.2. In the command window, click on file menu New M file.
3. In edit window, Type the program as follows below.
4. Then press F5 to save and run the current file.5. Click on the command window for any error.
6. Now the out can be viewed in the figure window.
PROGRAMME :
1. x = input( Enter the 1stsequence);2. h= input(Enter the 2ndsequence);
3. n1= length(x)4. n2= length(h)5. n= max(n1,n2)6. y=[]7. for k=1:n8. y= [ y h]9. h= circshift(h, [1 1])10.end11.out= y* x12.cout=out13.stem(cout)
-
7/31/2019 Chandu Dsp Manual
15/28
CONCLUSION:
From the above experiment, it is quit clear that the result obtained from the linear convolution
and circular convolution is different and the circular convolution is not only used for the
aperiodic signal as well as periodic signal. And the output graph also plotted successfully.
-
7/31/2019 Chandu Dsp Manual
16/28
EXPERIMENT No: 05
AIM OF THE EXPERIMENT: i) Find Auto correlation of a sequence.
ii) Find Cross correlation of two sequences
iii) Finding Power spectral density of a sequence.
APPARATUS REQUIRED : 1. Computer System
2. Matlab Software
THEORY:
Correlation is a mathematical operation that is very similar to convolution . Just as convolution,correlation uses two signals to produce a third signal. This third signal is called the Cross
Correlation. If a signal is correlated with itself, the resulting signal is called auto correlation.
EQUATION FOR CORRELATION:
Consider two data sequences, x[n],y[n] taken from the two corresponding waveforms might be
compared. If the two waveform varied similarly point to point, then the measure of correlation is
the sum of the products of the corresponding pairs of points.
N-1
rxy= x[n] y[n]n = 0
PROCEDURE: 1. Click on the matlab icon on the desktop.
2. In the command window, click on file menu New M file.
3. In edit window, Type the program as follows below.4. Then press F5 to save and run the current file.
5. Click on the command window for any error.6. Now the out can be viewed in the figure window.
PROGRAMME : Auto & Cross Correlation
1. x = input( Enter the 1stsequence);
2. h = input(Enter the 2ndsequence);3. y1 = xcorr(x,x)4. y2 = xcorr(x,h)5. subplot(1,2,1);6. stem(y1)7. subplot(1,2,2);8. stem(y2)
-
7/31/2019 Chandu Dsp Manual
17/28
Power Spectral Density
THEORY:
The power spectral density (PSD) is intended for continuous spectra. The integral of thePSD over a given frequency band computes the average power in the signal over that frequency
band. In contrast to the mean-squared spectrum, the peaks in this spectra do not reflect the power
at a given frequency.
PROCEDURE: 1. Click on the matlab icon on the desktop.2. In the command window, click on file menu New M file.
3. In edit window, Type the program as follows below.4. Then press F5 to save and run the current file.
5. Click on the command window for any error.
6. Now the out can be viewed in the figure window.
PROGRAMME :
1. Fs = 1000; t = 0:1/Fs:.296;
2. x = exp(i*2*pi*200*t)+randn(size(t));
3. h = spectrum.periodogram; % Instantiate a periodogram object.4. psd(h,x,'Fs',Fs); % Plots the two-sided PSD by default.
-
7/31/2019 Chandu Dsp Manual
18/28
CONCLUSION:
From the above experiment, the characteristic of cross & auto correlation is studied successfully
and the power over a band of frequency is calculated . the output graph also plotted successfully.
-
7/31/2019 Chandu Dsp Manual
19/28
EXPERIMENT No: 06
AIM OF THE EXPERIMENT: finding convolution using DFT and IDFT
APPARATUS REQUIRED : 1. Computer System
2. Matlab Software
THEORY:
DISCRETE FOURIER TRANSFORM
The discrete Fourier transform, or DFT, is the primary tool of digital signal processing. The
foundation of the Signal Processing Toolbox is the fast Fourier transform (FFT), a method for
computing the DFT with reduced execution time. Many of the toolbox functions (including z-
domain frequency response, spectrum and cepstrum analysis, and some filter design andimplementation functions) incorporate the FFT.
MATLAB provides the functions fft and ifft to compute the discrete Fourier transform and its
inverse, respectively. For the input sequence x and its transformed version X (the discrete-time
Fourier transform at equally spaced frequencies around the unit circle), the two functions
implement the relationships
In these equations, the series subscripts begin with 1 instead of 0 because of the MATLABvector indexing scheme, and
-
7/31/2019 Chandu Dsp Manual
20/28
PROCEDURE: 1. Click on the matlab icon on the desktop.
2. In the command window, click on file menu New M file.3. In edit window, Type the program as follows below.
4. Then press F5 to save and run the current file.
5. Click on the command window for any error.
6. Now the out can be viewed in the figure window.
PROGRAMME :
1. clear2. m = input('please Enter the size of x1(n) and x2(n):')3. for i = 1:m4. x1(i) = input('Please enter the values of x1:');5. end6. for i = 1:m7. x2(i) = input('Please enter the values of x2:');
8. end9. for k = 1:m10.y1(k) = 0.0;11.y2(k) = 0.0;12.for n = 1:m13.y1(k) = y1(k) + x1(n)*exp(-i*2*pi*(k-1)*(n-1)/m); % DFT14.y2(k) = y2(k) + x2(n)*exp(-i*2*pi*(k-1)*(n-1)/m);15.end16.end17.sprintf('X1(k) is:')18.disp(y1)19.sprintf('X2(k) is:')20.disp(y2)21.for k = 1:m22.y(k) = y1(k)*y2(k);23.end24.sprintf('X(k) = X1(k)*X2(k) is:')25.disp(y)26.for n = 1:m27.x3(n) = 0.0;28.for k = 1:m29.x3(n) = x3(n) + y(k)*exp(i*2*pi*(k-1)*(n-1)/m); % IDFT30.end31.end32.for n = 1:m33.x(n) = x3(n)/m;34.end35.sprintf('x(n) is:')36.disp(x)37.stem(x)
-
7/31/2019 Chandu Dsp Manual
21/28
% Creating N-point DFT function (Save as dft.m)
function xk=dft(xn,N);L=length(xn);if(N
-
7/31/2019 Chandu Dsp Manual
22/28
%5.(b)N-point IDFT% Creating N-point IDFT function (Save as idft.m)function xn=idft(Xk,N)for k=0:1:N-1for n=0:1:N-1p=exp(i*2*pi*n*k/N);x2(k+1,n+1)=p;endendxn=(Xk*x2)./N;
%******************************************************
% Implementation of DFT Function(Separate program)clear all;close all;clc;%***************************N=4;Xk=[2+2i,1,-2+3i,2];xn=idft(Xk,N);k=0:1:N-1;stem(k,xn);xlabel('time --->');ylabel('Magnitude ----->');title('N point IDFT ');
CONCLUSION:
From the above experiment, the convolution of two sequence is done using DFT and IDFT.
-
7/31/2019 Chandu Dsp Manual
23/28
EXPERIMENT No: 07
AIM OF THE EXPERIMENT: Determination of time FFT using function
APPARATUS REQUIRED : 1. Computer System
2. Matlab Software
THEORY: FFT
Compute fast Fourier transform (FFT) of input
The FFT block computes the fast Fourier transform (FFT) of each channel of an M-by-N or
length-M input, u, where M must be a power of two. To work with other input sizes, use the Zero
Pad block to pad or truncate the length-M dimension to a power-of-two length.
The output of the FFT block is equivalent to the MATLAB fft function:
y = fft(u) % Equivalent MATLAB code
Thekth entry of the lth output channel, y(k, l), is equal to the kth point of the M-point discreteFourier transform (DFT) of the lth input channel:
This block supports real and complex floating-point and fixed-point inputs.
PROCEDURE: 1. Click on the matlab icon on the desktop.
2. In the command window, click on file menu New M file.
3. In edit window, Type the program as follows below.
4. Then press F5 to save and run the current file.5. Click on the command window for any error.
6. Now the out can be viewed in the figure window.
PROGRAMME :
x=input('enter the sequence')N=length(x)w=exp((-j*2*pi)/N)for k=1:N
sum=0for n=1:N/2
sum=sum+((x((2*n)-1)).*(w.^((k-1)*((2*n)-2))))+(x(2*n).*(w.^((k-1)*((2*n)-1))))
endx(k)=sum
endxstem(x)
-
7/31/2019 Chandu Dsp Manual
24/28
CONCLUSION:
From the above experiment, we have done the time FFT using function.
1 2 3 4 5 6 7-20
-10
0
10
20
30
40
-
7/31/2019 Chandu Dsp Manual
25/28
EXPERIMENT No: 07
AIM OF THE EXPERIMENT: Design of Filter ( Low pass, High pass, Band pass using
Hamming, Hanning,Rectangular, Kaiser Window)
APPARATUS REQUIRED : 1. Computer System
2. Matlab Software
THEORY: FIR Filters
The Image Processing Toolbox supports one class of linear filter, the two-dimensional finite
impulse response (FIR) filter. FIR filters have several characteristics that make them ideal for
image processing in the MATLAB environment: FIR filters are easy to represent as matrices ofcoefficients. Two-dimensional FIR filters are natural extensions of one-dimensional FIR filters.
There are several well-known, reliable methods for FIR filter design. FIR filters are easy to
implement. FIR filters can be designed to have linear phase, which helps prevent distortion.
Another class of filter, the infinite impulse response (IIR) filter, is not as suitable for image
processing applications. It lacks the inherent stability and ease of design and implementation ofthe FIR filter.
Digital filters with finite-duration impulse response (all-zero, or FIR filters) have both
advantages and disadvantages compared to infinite-duration impulse response (IIR) filters. FIR
filters have the following primary advantages: They can have exactly linear phase. They are
always stable. The design methods are generally linear. They can be realized efficiently inhardware. The filter startup transients have finite duration. The primary disadvantage of FIR
filters is that they often require a much higher filter order than IIR filters to achieve a given level
of performance. Correspondingly, the delay of these filters is often much greater than for anequal performance IIR filter.
PROCESS:
Designing a Digital Filter
In this topic, you use a Digital Filter Design block to create low frequency noise, which models
the wind noise inside the cockpit:
If the model you created in Modifying Your Model is not open on your desktop, you can open an
equivalent model by typingdoc_gstut3
at the MATLAB command prompt. This model contains a Time Scope block that displays the
original sine wave and the sine wave with white noise added.
PROCEDURE: 1. Click on the matlab icon on the desktop.
2. In the command window, click on file menu New M file.
3. In edit window, Type the program as follows below.4. Then press F5 to save and run the current file.
5. Click on the command window for any error.
-
7/31/2019 Chandu Dsp Manual
26/28
6. Now the out can be viewed in the figure window.
PROGRAMME :clc;wp=input('enter passband edge')
ws=input('enter stopband edge')dp=input('enter passband attenuation')ds=input('enter stopband attenuation')[N,wn]=buttord(wp,ws,dp,ds) [b,a]=butter(N,wn)[h,w]=freqz(b,a)mag=20*log10(abs(h))phase=180*angle(h)/pifigure(1)plot(w,abs(h))title('butterwort lpf')
xlabel('feq')ylabel('mag')gridfigure(2)subplot(2,1,1)plot(w,mag)title('magnitude')plot(w,phase)grid on
-
7/31/2019 Chandu Dsp Manual
27/28
0 0.5 1 1.5 2 2.5 3 3.50
0.2
0.4
0.6
0.8
1
1.2
1.4butterwort lpf
feq
mag
-
7/31/2019 Chandu Dsp Manual
28/28
0 0.5 1 1.5 2 2.5 3 3.5-200
-100
0
100
200