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

Matlab Exercise 3

This document provides instructions for plotting different types of signals using MATLAB. It includes examples of plotting periodic waveforms like sawtooth and square waves, the product of functions, and the real, imaginary, magnitude, and phase parts of a complex discrete signal. It then provides 4 signal processing examples to plot, including the product or difference of signals and the various components of a complex signal over time.

Uploaded by

Gineth Castro
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)
37 views

Matlab Exercise 3

This document provides instructions for plotting different types of signals using MATLAB. It includes examples of plotting periodic waveforms like sawtooth and square waves, the product of functions, and the real, imaginary, magnitude, and phase parts of a complex discrete signal. It then provides 4 signal processing examples to plot, including the product or difference of signals and the various components of a complex signal over time.

Uploaded by

Gineth Castro
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/ 2

Signals, Spectra, & Signal Processing Laboratory | eʃernαn dz

MATLAB EXERCISE NO.3

Basic Signal Plotting

OBJECTIVE:

Plot different type of signals using Matlab.

PROGRAM:

Basic Signals
The following exercises will introduce you to basic signal plotting.
Write a short description on the blank lines regarding its respective Matlab code.

(a) Periodic Waveforms

fs = 8000; ___________________________________________
t = 0:1/fs:3;
z1 = sawtooth(2*pi*t); ___________________________________________
figure(1) ___________________________________________
subplot(211) ___________________________________________
plot(t,z1)
axis([0 3 -1 1]) ___________________________________________
z2 = square(2*pi*t); ___________________________________________
subplot(212) ___________________________________________
plot(t,z2)
axis([0 3 -1 1]) ` ___________________________________________

(b) Product of Functions

t = linspace(0,3,200); ___________________________________________
z3 = t.^2; ___________________________________________
z4 = sin(10*t); ___________________________________________
z = z3.*z4; ___________________________________________
figure(2) ___________________________________________
subplot(211) ___________________________________________
stem(t,z)
xlabel(‘Time’)
title(‘Discrete Product of Functions’)
subplot(212) ___________________________________________
plot(t,z)
xlabel(‘Time’)
title(‘Continuous Product of Functions’) ________________________________

1
Signals, Spectra, & Signal Processing Laboratory | eʃernαn dz

(c) Complex Discrete Signal


This program will plot the magnitude, phase, real, and imaginary part of a
complex-valued signal.

n = -10:10; ___________________________________________
x = exp((-.1+j*.3)*n); ___________________________________________
r = real(x); ___________________________________________
i = imag(x); ___________________________________________
m = abs(x); ___________________________________________
p = angle(x); ___________________________________________
figure(3) ___________________________________________
subplot(221) ___________________________________________
stem(n,r) ___________________________________________
title('real part')
xlabel('n')
subplot(222) ___________________________________________
stem(n,i)
title('imaginary part')
xlabel('n')
subplot(223) ___________________________________________
stem(n,m)
title('magnitude part')
xlabel('n')
subplot(224) ___________________________________________
stem(n,p)
title('phase part')
xlabel('n')

Now plot the following signals. Use a two-paneled window for each figure. Use
subplot(2,1,?) to display both plots in the same window. For items 1 to 3, plot
each part of the two signals on the first panel, then plot the product (difference in
item 3) on the second panel. For number 4, plot the real and imaginary part on
the first panel, then plot the magnitude and phase part on the second. Use
legend to identify signals plotted on a single panel. Use grid for all plots that
starts t = 0.

1. f(t) = e-t g(t) = sin(10πt)u(t) x1(t) = e-t * sin(10πt)u(t)

2. f(t) = t g(t) = e-t u(t) x2(t) = t * e-t u(t)

3. f(f) = e-tu(t) g(t) = e-2tu(t) x3(t) = (e-t - e-2t)u(t)

4. x(t) = 3e-j(50πt - 0.4π)u(t), for t range of 3 periods

Instructor’s Verification ____________________

You might also like