0% found this document useful (0 votes)
96 views

DSP Experiment 1

This document describes a MATLAB experiment to generate and analyze sinusoidal waveforms. The experiment involves: 1. Creating a MATLAB m-file program to generate 3 cosine sequences with user-defined frequencies, amplitudes, and sampling rate. 2. Running the program to generate the cosine waveforms and their magnitude spectra, displayed as subplots. 3. Exercises to modify the frequencies/amplitudes, display the signals discretely using stem instead of plot, and generate sine waves instead of cosine waves. The objective is to introduce digital signal processing concepts like sampling and generation of basic sinusoidal signals that are important for analyzing and testing electronic circuits. Students will run the program and modify it to explore effects of

Uploaded by

Hari Prasath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views

DSP Experiment 1

This document describes a MATLAB experiment to generate and analyze sinusoidal waveforms. The experiment involves: 1. Creating a MATLAB m-file program to generate 3 cosine sequences with user-defined frequencies, amplitudes, and sampling rate. 2. Running the program to generate the cosine waveforms and their magnitude spectra, displayed as subplots. 3. Exercises to modify the frequencies/amplitudes, display the signals discretely using stem instead of plot, and generate sine waves instead of cosine waves. The objective is to introduce digital signal processing concepts like sampling and generation of basic sinusoidal signals that are important for analyzing and testing electronic circuits. Students will run the program and modify it to explore effects of

Uploaded by

Hari Prasath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

UNIVERSITI TENAGA NASIONAL

Dept. of Electrical and Communication Engineering


College of Engineering
Semester: I / II / Special
Academic Year: 20./20..
Course Code :
Course Instructor:
Title:
Objective:

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.

Launch MATLAB by double clicking the matlab icon.


The following window will be display:-

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.

On the editor window:Select File


Save as and type m-file name as exp1.
Make sure that the fplot.m file is present in your matlab current directory.
On the Matlab window and subwindow current directory right click exp1.m and
select run.

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.

You might also like