0% found this document useful (0 votes)
337 views11 pages

Reference: DSP LAB by Sanjit K. Mitra

This document describes procedures for plotting different types of signals in MATLAB, including amplitude modulated (AM) signals, swept frequency signals, and approximated random signals. It provides MATLAB scripts to generate and plot these signals. It also includes tasks to modify the scripts and questions about signal processing concepts.

Uploaded by

yelyah serious
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)
337 views11 pages

Reference: DSP LAB by Sanjit K. Mitra

This document describes procedures for plotting different types of signals in MATLAB, including amplitude modulated (AM) signals, swept frequency signals, and approximated random signals. It provides MATLAB scripts to generate and plot these signals. It also includes tasks to modify the scripts and questions about signal processing concepts.

Uploaded by

yelyah serious
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/ 11

Signals Spectra and Signal Processing

Laboratory Exercise 3
MATLAB SIGNAL PLOTTING AND OPERATIONS
Reference: DSP LAB by Sanjit k. Mitra

Objective

Plot signal sequence, AM and swept frequency signal


Create matlab program for sawtooth signals

Material
MATLAB r2020a or any version

Procedures
7. Run the matlab application and open an Editor (ctrl + N)

8. For the AM signal y[n], A is the amplitude, xL[n]) is the modulating signal (low frequency), xH[n]
is the carrier (high frequency) and m is the modulation index.

y[n]=A(1 + m · xL[n])xH[n]=A(1 + m · cos(ωLn)) cos(ωHn),

Write the following scripts. This will generate and plot an AM signal

%% PART 1
% Generate amplitude modulated sequence
clf;
n = 0:100;
m = 0.4;
fH = 0.1;
fL = 0.01;
xH = sin(2*pi*fH*n);
xL = sin(2*pi*fL*n);
y = (1+m*xL).*xH;
stem(n,y);
grid;
xlabel(’Time index n’);
ylabel(’Amplitude’);

9. Save the script from editor with .m file extension


10. Run the script (ctrl + Enter) and study the output.
11. Write the following scripts. This will generate and plot swept frequency sine wave

%% Part 2
% Generation of a swept frequency sinusoidal sequence
n = 0:100;
a = pi/2/100;
b=0;
arg = a*n.*n + b*n;
x = cos(arg);
clf;
stem(n, x);
axis([0,100,-1.5,1.5]);
title(’Swept-Frequency Sinusoidal Signal’);
xlabel(’Time index n’);
ylabel(’Amplitude’);
grid; axis;

12. Save the script from editor with .m file extension


13. Run the script (or ctrl + Enter) and study the output.

14. Write the following scripts. This will generate and plot approximated random signal

%% PART 3
% Signal Smoothing by Averaging
clf;
R = 51;
d = 0.8*(rand(R,1) - 0.5); % Generate random noise
m = 0:R-1;
s = 2*m.*(0.9.^m); % Generate uncorrupted signal
x=s+d’; %Generate noise corrupted signal
subplot(2,1,1);
plot(m,d’,’r-’,m,s,’g--’,m,x,’b-.’);
xlabel(’Time index n’);
ylabel(’Amplitude’);
legend(’d[n] ’,’s[n] ’,’x[n] ’);
x1 = [0 0 x];
x2 = [0 x 0];
x3 = [x 0 0];
y = (x1 + x2 + x3)/3;
subplot(2,1,2);
plot(m,y(2:R+1),’r-’,m,s,’g--’);
legend(’y[n] ’,’s[n] ’);
xlabel(’Time index n’);
ylabel(’Amplitude’);

15. Save the script from editor with .m file extension


16. Run the script (or ctrl + Enter) and study the output.

Task
Perform the following tasks and record the answers. Provide the screenshots of the scripts used, results,
and workspace, and graph. You can use matlab for pc or matlab for android.
Answer the questions after performing the task
Use minimum command lines and number of scripts as possible.
8. Modify the script for PART 1 to create a smoother AM signal. You can have any time limit.

9. Write a script that will create square waves

a.

b.
10. Write a script that will create sawtooth waves

a.

b.

Critical Thinking Questions:


4. How can you modify the frequencies of the swept frequency signal (PART 2)?
5. For the PART 3: signal smoothing and averaging, what are the relationships between signals x, x1,
x2 and x3?
6. What is the purpose of legend command?

Paste the screenshots of your answers on a ms word document with the answers to the questions. Use the
format below
LABORATORY EXERCISE NO. 3
___________TITLE__________

Name : ___________________________________________
Section: _______________________________
Task:
3.

4.

Questions:
3. ___________
4. __________
LABORATORY EXERCISE NO. 3
MATLAB SIGNAL PLOTTING AND OPERATIONS

Name : Soriano,
Gallano, John Carlo D.
Edwin A._________
Section: _______________________________

PROCEDURE ANSWERS:
8.
11.

14.
TASK ANSWERS:
1.
Ac=5
AM=1
Fc=16
Fm=0.02
m=1
tl=linspace(0,600,600)
y1=sin(2*pi*Fm*tl)
y2=sin(2*pi*Fc*tl)
Y=(1+m.*y1).*(Ac.*y2)
subplot(3,1,1)
plot(tl,y1)
xlabel('Time Index')
ylabel('Amplitude')
title('message signal')
subplot(3,1,2)
plot(tl,y2)
xlabel('Time Index')
ylabel('Amplitude')
title('Carrier signal')
subplot(3,1,3)
plot(tl,y2)
xlabel('Time Index')
ylabel('Amplitude')
title('Modulated signal')
2.A.
L=30;
A=2.25;
N=15
omega=2*pi/N
T=0:omega:(L-1)*omega
X=0:L-1
Vsquare=A*square(T,65)
hold On
stem(X,Vsquare)
subplot(2,1,1);
xlabel('Time Index n')
ylabel('Amplitude')
title('square Wave')

2.B
L=30;
A=2.25;
N=15
omega=2*pi/N
T=0:omega:(L-1)*omega
X=0:L-1
Vsquare=A*square(T,30)
hold On
stem(X,Vsquare)
subplot(2,1,1);
xlabel('Time Index n')
ylabel('Amplitude')
title('square Wave')
3.A
L=60;
A=4;
N=20
omega=2*pi/N
T=0:omega:(L-1)*omega
X=0:L-1
Vsaw=A*sawtooth(T)
hold On
stem(X,Vsaw)
subplot(2,1,1);
xlabel('Time Index n')
ylabel('Amplitude')
title('Saw Tooth Wave')

3.B
L=60;
A=4;
N=20
omega=2*pi/N
T=0:omega:(L-1)*omega
X=0:L-1
Vsaw=A*sawtooth(T,.5)
hold On
stem(X,Vsaw)
subplot(2,1,1);
xlabel('Time Index n')
ylabel('Amplitude')
title('Saw Tooth Wave')

QUESTIONS:

1. How can you modify the frequencies of the swept frequency signal (PART 2)?
I can modify the frequencies of the swept frequency signal (PART 2) through changing the axix
values.

2. For the PART 3: signal smoothing and averaging, what are the relationships between signals x, x1,
x2 and x3?
Through the signals 1. x, x1, x2 and x3, it just indicate the result of the wave.

3. What is the purpose of legend command?


The purpose of legend command is that it is used to create a legend with descriptive labels for
each plotted data series. What’s more is that for the labels, the legend uses the text from the
display name properties of the data series.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy