KEMBAR78
SS Lab2 | PDF | Discrete Time And Continuous Time | Applied Mathematics
0% found this document useful (0 votes)
3 views3 pages

SS Lab2

The document outlines a MATLAB lab exercise focused on basic plotting of continuous and discrete-time signals. It includes instructions for using various plotting commands, such as plot and stem, and tasks for creating specific plots with titles and axis labels. Additionally, it covers convolution operations using the conv command and provides a scenario for plotting a sampled signal with given sample data.

Uploaded by

wpl5304
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)
3 views3 pages

SS Lab2

The document outlines a MATLAB lab exercise focused on basic plotting of continuous and discrete-time signals. It includes instructions for using various plotting commands, such as plot and stem, and tasks for creating specific plots with titles and axis labels. Additionally, it covers convolution operations using the conv command and provides a scenario for plotting a sampled signal with given sample data.

Uploaded by

wpl5304
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/ 3

Lab 2: Basic Plotting of Signals

Using MATLAB, make plots of the signals below. Put your code in a Matlab script file so you
can rerun it from the Matlab command after you make revisions to your file.
Use the subplot command to put several plots on the same page. Print out the plots and turn
them in with your code. Use help subplot to find out how to use the command.
Use the plot command to plot continuous-time signals. Use the stem command to plot discrete-
time signals. Use help plot and help stem to find out how to use these commands. Our conven-
tion is that f (t) denotes a continuous-time signal, and that f (n) denotes a discrete-time signal.

1. Plotting Continuous-Time Signals

For the following: Run the following three lines and explain why the plots are di↵erent.

t = 0:2*pi; plot(t,sin(t))

t = 0:0.2:2*pi; plot(t,sin(t))

t = 0:0.02:2*pi; plot(t,sin(t))

For the last graph, add a title and axis labels with:

title(’My Favorite Function’)

xlabel(’t (Seconds)’)

ylabel(’y(t)’)

Change the axis with:

axis([0 2*pi -1.2 1.2])

Put two plots on the same axis:

t = 0:0.2:2*pi; plot(t,sin(t),t,sin(2*t))

Produce a plot with out connecting the points:

t = 0:0.2:2*pi; plot(t,sin(t),’.’)

Try the following command:

t = 0:0.2:2*pi; plot(t,sin(t),t,sin(t),’r.’)

What does the r do?

8
2. Plotting Discrete-Time Signals

Use stem to plot the discrete-time step-function:

n = -10:10;

f = n >= 0;

stem(n,f)

Make stem plots of the following signals. Decide for yourself what the range of n should be.

f (n) = u(n) u(n 4)


g(n) = n · u(n) 2 (n 4) · u(n 4) + (n 8) · u(n 8)
x(n) = (n) 2 (n 4)
y(n) = (0.9)n (u(n) u(n 20))
v(n) = cos(0.12 ⇡n) u(n)

3. The conv Command

Use help conv to find out how to use the conv command.

Let

f (n) = u(n) u(n 4)


g(n) = n · u(n) 2 (n 4) · u(n 4) + (n 8) · u(n 8).

Make stem plots of the following convolutions. Use the MATLAB conv command to compute
the convolutions.

(a) f (n) ⇤ f (n)


(b) f (n) ⇤ f (n) ⇤ f (n)
(c) f (n) ⇤ g(n)
(d) g(n) ⇤ (n)
(e) g(n) ⇤ g(n)

Comment on your observations: Do you see any relationship between f (n) ⇤ f (n) and g(n) ?
Compare f (n) with f (n) ⇤ f (n) and with f (n) ⇤ f (n) ⇤ f (n). What happens as you repeatedly
convolve this signal with itself?

Use the commands title, xlabel, ylabel to label the axes of your plots.

9
4. Plotting a Sampled-Signal.

Suppose the continuous-time signal x(t) is sampled with a sampling period of 0.3 seconds
between each sample. Suppose also that the first sample is at t = 0 and that a total of 12
samples are collected. The table below lists the samples of x(t) that were collected.

sample number x(t)


0 6.0
1 -1.3
2 -8.0
3 -11.7
4 -11.0
5 -6.0
6 1.3
7 8.0
8 11.7
9 11.0
10 6.0
11 -1.3

Using the plot command, make a plot of this signal. The horizontal axis should be labeled:
TIME (SECONDS). Make sure that the horizontal time axis shows the correct time for each
sample: 0, 0.3, 0.6, . . . , 3.3.

10

You might also like