You are on page 1of 10

Digital Signal Processing LAB

Lab Report
By

Nimra Noor (F18604006)


National University of Technology

Computer Engineering Department

Digital Signal Processing LAB

Submitted
To
Lec. Rafi

Semester: 6th
Session: Spring 2021
Credit Hours: 1
Time: 3 Hours

2
National University of Technology

Experiment List

Sr.No. Experiments

1 Plotting sinusoids using MATLAB

2 Introduction to Complex Exponentials


3 Spectrum representation
4
5
6
7
8
9
10
11
12
13
14

3
National University of Technology

Experiment 3
Spectrum Representation

Objective

To introduce more complicated signals that are related to the basic sinusoid and implement
frequency modulation (FM) and amplitude modulation (AM) in MATLAB.

Theoretical Explanation

Amplitude Modulation
If we add several sinusoids, each with a different frequency 𝑓𝑘 we can express the result as:

where 𝑨𝒌𝒆𝒋𝝓𝒌 is the complex amplitude of the k th complex exponential term. The choice of 𝑓𝑘 will
determine the nature of the signal for amplitude modulation or beat signals we pick two or three
frequencies very close together.
(In amplitude modulation, the frequency of the carrier wave is constant. The frequency spectrum of an
AM signal includes sidebands, but those aren't the carrier wave. You'll note that the amplitude changes; it
increases and decreases in accordance with the modulation, however the frequency of this wave does not
change.)

Frequency Modulated Signals


We will also look at signals in which the frequency varies as a function of time. In the constant-
frequency sinusoid (1) the argument of the cosine is also the exponent of the complex exponential, so the
angle of this signal is the exponent (𝟐𝝅𝒇𝒐𝒕 + 𝝋). This angle function changes linearly versus time, and
its time derivative is 𝟐𝝅𝒇𝒐 which equals the constant frequency of the cosine in rad/s.
A generalization is available if we adopt the following notation for the class of signals represented by a
cosine function with a time-varying angle:
The time derivative of the angle from (3) gives a frequency in rad/s
but we prefer units of hertz, so we divide by 𝟐𝝅 to define the instantaneous frequency.

4
National University of Technology

Explanation of Procedure
A. Tools/Commands
1. MATLAB
B. Codes
Task 3.1
Beat Control GUI: To assist you in your experiments with beat notes and AM signals, the tool
called beatcon has been created. This user interface controller will exhibit the basic signal
shapes for beat signals and play the signals. A small control panel will appear on the screen with
buttons and sliders that vary the different parameters for the beat signals. It can also call a user-
written function called beat.m. Experiment with the beatcon control panel and use it to
produce a beat signal with two frequency components at 850 Hz and 870 Hz. Demonstrate the
plot and sound to your instructor.

5
National University of Technology

6
National University of Technology

Task 3.2
Function for a Chirp: Use the code provided as a starting point in order to write a MATLAB
function that will synthesize a “chirp” signal according to the following comments:

[xx,tt]=mychirp(2500, 500, 1.5, 11025);

function [xx,tt]=mychirp(f1,f2,dur,fsamp)
if (nargin<4)
fsamp=11025;
end
tt=0:1/fsamp:dur;
m=(f1-f2)/(2*dur);
psi= 2*pi*(m*tt.*tt+f1*tt+100);
xx=real(7.7*exp(1i*psi));
soundsc(xx,fsamp);
end

7
National University of Technology

Task 3.3
Spectrograms: It is often useful to think of signals in terms of their spectra. A signal’s spectrum
is a representation of the frequencies present in the signal. For a constant frequency sinusoid as
in
I Introduces to Complex Exponentials using MATLAB live script To study basics of plotting
complex exponential functions and to familiarize student with implementation of plotting of
complex exponentials in MATLAB.
fs=8000;
xx=cos(3000*pi*(0:1/fs:0.5));
specgram(xx,1024,fs);
colorbar

8
National University of Technology

Task 3.4
Beat Nodes: Consider the situation in which we had two sinusoidal signals of slightly different
frequencies, i.e.,
[xx,tt]=mychirp(2500, 500, 1.5, 11025);
function [xx,tt]=beat(A,B,fc,delf,fsamp,dur)
if (nargin<6)
dur=0.5;
end
fs=8000;
f1=fc-delf;
f2=fc+delf;

xx= syn_sin([f1 f2 0],[A B 0], fs, dur, 0);


ff=mychirp(f1,f2,0.5,fsamp)
end
function [xx,tt]=beat(A,B,fc,delf,fsamp,dur)

9
National University of Technology

Conclusion

All the signals discussed so far in previous labs do not change in frequency over time. Obtaining a
signal with time-varying frequency is of main focus of this lab. A signal that varies in frequency
over time is called “chirp”. The frequency of the chirp signal can vary from low to high frequency
(up-chirp) or from high to low frequency (low-chirp).

10

You might also like