DSP Experiment 1
DSP Experiment 1
ECCB311
Section:
Date:
Experiment No :
Time:
Assignment Marks:
Laboratory Report (PO4a and PO4b)
PO4: Conduct Investigations, Interpret data and provide conclusions in investigating complex
problems related to electrical engineering
a) Usage of modern tool
b) Manipulation of modern tool to execute complex engineering activities
Laboratory works
Results: data, figure, graphs, tables, etc
/15 marks
Analysis
Discussion
Question 1
Question 2
Question 3
Total
Laboratory Skills:
/3 marks
/1 marks
/1 marks
/20 marks
PO5: Create appropriate techniques, select resources, and apply modern engineering tools to
execute complex engineering activities
a) Usage of modern tool
b) Manipulation of modern tool to execute complex engineering activities
Scale
1
2
3
4
5
Blooms Level 1(Perception) 2
3(Guided
4
5(Complete
Response)
Overt
Response)
Criteria
Familiarity on tool(s)
Operation of tools(s)
Total
Scale: 1- 5
/10 marks
Experiment 1.
Introduction to Digital Signal Processing. Generation of Sinusoidal Waveform.
The use of sinusoidal signal form part of the basic signal used to analyzed more general
form of other signal waveforms. Through the theory of Fourier Transforms , we have
seen how this can be done. Furthermore sinusoidal signals are used to test the functioning
of electronic circuits. Although the course is mainly devoted to digital signals, we will
also learn how to generate a continuous sinusoidal signal using MATLAB commands.
Procedure:1.
2.
Create working directory and Change Current Directory (label in Red in figure
above) (Example: C:\<Your_Student_ID>\Matlab)
NOTE: This will be your working MATLAB Directory throughout the semester
3.
Select File
New
M-File.
An untitled Editor window as below will be display.
4.
Key in or mark, copy and paste the following matlab program text into the editor
window.
% Program Exp1
% Generation of cosine sequence
%
fs = input('\nGeneration of 3 Cosine Sequences\nType in freq of
sampling in Hertz = ');
f1 = input('Type in freq of first cosine sequence in Hertz = ');
f2 = input('Type in freq of second cosine sequence in Hertz = ');
f3 = input('Type in freq of third cosine sequence in Hertz = ');
K1 = input('Type in the first gain constant = ');
K2 = input('Type in the second gain constant = ');
K3 = input('Type in the third gain constant = ');
N = input ('Type in length of sequence = ');
n = 0:N;
%x = K*exp(c*n);%Generate the sequence
xa1=K1*cos(2*pi*(n)*f1/fs);
xa2=K2*cos(2*pi*(n)*f2/fs);
xa3=K3*cos(2*pi*(n)*f3/fs);
dt=1/fs;
t=n*dt;
subplot(3,2,1);
plot(t,xa1);%Plot the first cosine signal
xlabel('Time t in sec');ylabel('Amplitude');
title('Cosine Signal');
% pause;
% Calling the ploting of the magnitude spectrum function
subplot(3,2,2);
fplot(xa1,dt);
subplot(3,2,3);
plot(t,xa2);%Plot the first cosine signal
xlabel('Time t in sec');ylabel('Amplitude');
title('Cosine Signal');
subplot(3,2,4);
fplot(xa2,dt);
subplot(3,2,5);
plot(t,xa3);%Plot the first cosine signal ubplot(3,2,3);
xlabel('Time t in sec');ylabel('Amplitude');
title('Cosine Signal');
subplot(3,2,6);
fplot(xa3,dt);
5.
6.
At command subwindow you will notice the following prompt:Generation of 3 Cosine Sequences
Type in freq of sampling in Hertz =
Key in 8000 as the sampling frequency and subsequently enter the required data as
shown in the command subwindow below:-
Exercise
(1) Display other frequencies and amplitudes of the 3 cosine waveforms with the sampling
rate remain fixed at 8000Hz. Briefly explain what happened to the waveforms due to the
changes.
(2) Modify the program to display discrete form of the cosine waveforms. Hint: use stem
instead of plot.
(3) Modify the program to display sine waveforms for the discrete time signal case.