Sunteți pe pagina 1din 28

EXPERIMENT No: 1 AIM OF THE EXPERIMENT: Working with a DSP processor( Fixed pointTM320VC5416/ Floating point series) APPARATUS

REQUIRED : 1. Computer System with SP-2 OS. 2. Micro-5416 DSP kit 3. 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 serial menu 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.

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 click ok. 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 <location> 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 <output location> and enter key.

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 directory is 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.

15. In communication window substitute your input at a location given in c file by typing SD <location> 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 <output location> and enter key.

EXPERIMENT No: 02 AIM OF THE EXPERIMENT: Generation of Different types of signal (Both Continuous and Discrete). APPARATUS REQUIRED : 1. Computer System 2. Matlab Software

THEORY:

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 (A)Unit Step Sequence 1. 2. 3. 4. 5. N=21; n=0:1:N-1; x=ones(1,N); plot(x) % for continuous signal stem(x) % for Discrete signal

(B) Unit ramp Sequence 1. N=21; 2.n=0:1:N-1; 3.x=0:N-1 4. plot(x) % for continuous signal 5.stem(x) % for Discrete signal

(C )Sinusoidal Signal 1. 2. 3. 4. 5. N=21; n=0:1:N-1; x=sin(0.1*pi*n); plot(x) % for continuous signal stem(x) % for Discrete signal

(D) Addition of Two signals 1. 2. 3. 4. 5. N=21; n=0:1:N-1; x= sin(0.1*pi*n) + cos(0.1*pi*n); plot(x) % for continuous signal stem(x) % for Discrete signal

(E) Exponential Signal 1. 2. 3. 4. 5. N=21; n=0:1:N-1; x=exp(n); plot(x) stem(x)

% for Continuous signal % for Discrete signal

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.

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 System 2. Matlab Software CONVOLUTION

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. LINEAR SYSTEM h[n] ------------------ y[n]

x[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.

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 1st sequence); % x=[1 2 3 4] 2. h=input(enter the 2nd sequence); % h=[2 3 4 5] 3. n1=length(x) 4. n2=length(h) 5. n=n1+n2-1 6. H=zeros(n,n) 7. x1= zeros(1,n) 8. x1(1,1:n1)=x 9. x1=x1 10. h1=h 11. H(1:n2,1)=h1 12. For c=2:1:n 13. For r= 2:1:n 14. H(r,c)= H(r-1,c-1) 15. End 16. End 17. Y=H*x1 18. Y=Y 19. Stem(Y)

CONCLUSION: From the above experiment it is clear that to find out the response of a signal when a impulse is present.

EXPERIMENT No: 04 AIM OF THE EXPERIMENT: Circular Convolution of sequences APPARATUS REQUIRED : 1. Computer System 2. Matlab Software CIRCULAR CONVOLUTION

THEORY:

In circular convolution it is necessary that the two sequences be of same length. It is similar to the 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-1 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 : 1. x = input( Enter the 1st sequence); 2. h= input(Enter the 2nd sequence); 3. n1= length(x) 4. n2= length(h) 5. n= max(n1,n2) 6. y=[] 7. for k=1:n 8. y= [ y h] 9. h= circshift(h, [1 1]) 10. end 11. out= y* x 12. cout=out 13. stem(cout)

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.

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:

AUTO CORRELATION & CROSS CORRELATION

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. 2. 3. 4. 5. 6. 7. 8. x = input( Enter the 1st sequence); h = input(Enter the 2nd sequence); y1 = xcorr(x,x) y2 = xcorr(x,h) subplot(1,2,1); stem(y1) subplot(1,2,2); stem(y2)

Power Spectral Density THEORY: The power spectral density (PSD) is intended for continuous spectra. The integral of the PSD 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.

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.

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 zdomain frequency response, spectrum and cepstrum analysis, and some filter design and implementation 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 MATLAB vector indexing scheme, and

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. clear 2. m = input('please Enter the size of x1(n) and x2(n):') 3. for i = 1:m 4. x1(i) = input('Please enter the values of x1:'); 5. end 6. for i = 1:m 7. x2(i) = input('Please enter the values of x2:'); 8. end 9. for k = 1:m 10. y1(k) = 0.0; 11. y2(k) = 0.0; 12. for n = 1:m 13. y1(k) = y1(k) + x1(n)*exp(-i*2*pi*(k-1)*(n-1)/m); % DFT 14. y2(k) = y2(k) + x2(n)*exp(-i*2*pi*(k-1)*(n-1)/m); 15. end 16. end 17. sprintf('X1(k) is:') 18. disp(y1) 19. sprintf('X2(k) is:') 20. disp(y2) 21. for k = 1:m 22. y(k) = y1(k)*y2(k); 23. end 24. sprintf('X(k) = X1(k)*X2(k) is:') 25. disp(y) 26. for n = 1:m 27. x3(n) = 0.0; 28. for k = 1:m 29. x3(n) = x3(n) + y(k)*exp(i*2*pi*(k-1)*(n-1)/m); % IDFT 30. end 31. end 32. for n = 1:m 33. x(n) = x3(n)/m; 34. end 35. sprintf('x(n) is:') 36. disp(x) 37. stem(x)

% Creating N-point DFT function (Save as dft.m) function xk=dft(xn,N); L=length(xn); if(N<L) error('N must be >=L'); end x1=[xn,zeros(1,N-L)]; for k=0:N-1 for n=0:1:N-1 w=exp(-i*2*pi*n*k/N); x2(k+1,n+1)=w; end end xk=x1*x2; %*************************** % Implementation of DFT Function(Separate program) clear all; close all; clc; %*************************** xn=[1 1 1]; N=80; Xk=dft(xn,N); mag=abs(Xk); ang=angle(Xk); k=0:N-1; subplot(2,1,1); stem(k,mag); title('N point DFT '); xlabel('time --->'); ylabel('Magnitude ----->'); subplot(2,1,2);stem(k,ang); xlabel('time --->'); ylabel('angle ----->'); %******************************************************

%5.(b)N-point IDFT % Creating N-point IDFT function (Save as idft.m) function xn=idft(Xk,N) for k=0:1:N-1 for n=0:1:N-1 p=exp(i*2*pi*n*k/N); x2(k+1,n+1)=p; end end xn=(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.

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 discrete Fourier 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=0 for 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)))) end x(k)=sum end x stem(x)

40

30

20

10

-10

-20

CONCLUSION: From the above experiment, we have done the time FFT using function.

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 of coefficients. 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 of the 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 in hardware. 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 an equal 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 typing doc_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.

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)/pi figure(1) plot(w,abs(h)) title('butterwort lpf') xlabel('feq') ylabel('mag') grid figure(2) subplot(2,1,1) plot(w,mag) title('magnitude') plot(w,phase) grid on

butterwort lpf 1.4

1.2

0.8
mag

0.6

0.4

0.2

0.5

1.5 feq

2.5

3.5

200 100 0 -100 -200

0.5

1.5

2.5

3.5

S-ar putea să vă placă și