You are on page 1of 8

Laboratory 4 - Transformations of the

Independent Variable
Signals and Systems
Department of Computer Engineering
College of Computer and Information Sciences
King Saud University
Student Name:

Student ID:

Instructions

1. Read this document before coming to the laboratory.

2. Print this document and bring it with you to the laboratory.

3. Mobile phones are not allowed.

4. Do not copy paste the code - type it.

5. Use only the front side of the sheets.

Marking Scheme

Task Points Obtained


1 25
2 25
3 25
4 25
Total 100

1
Laboratory 4 - Transformations of the
Independent Variable
Contents
4.1 Generating a continuous-time signal for the transformation of
the independent variable . . . . . . . . . . . . . . . . . . . . . 3
4.2 Student Task 1 - Plot a continuous-time signal . . . . . . . . . 5
4.3 Student Task 2 - Apply transformation of the independent
variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.4 Student Task 3 - Write code for a plotted signal . . . . . . . . 7
4.5 Student Task 4 - Transformation of the independent variable
of the plotted signal . . . . . . . . . . . . . . . . . . . . . . . . 8

2
4.1 Generating a continuous-time signal for the trans-
formation of the independent variable
We want to generate a continuous-time function/signal that is composed of
different parts and is given by the following Equation.


 0, t ≤ 0

1, 0 ≤ t ≤ 1
x(t) =


 2 − t, 1 ≤ t ≤ 2
0, t ≥ 2

Note: You are advised to study the equation of a straight line given by
y = mx + c before going further in this laboratory.

The inline function allows us to specify or define the signal. x(t) is coded
into Matlab for the cases where the value of x(t) 6= 0.

clear all
close all
clc
x = inline('((t>=0)&(t<=1)) + (2-t).*((t>=1) & (t<=2))','t');
t = -3:0.001:3;
subplot(4,1,1), plot(t,x(t)), axis([-3 3 -0.1 1.1]), ...
title('Original Signal, x(t)')
subplot(4,1,2), plot(t,x(t+1)), axis([-3 3 -0.1 1.1]), ...
title('Time-Shifted Signal, x(t+1)')
subplot(4,1,3),plot(t,x(-t+1)),axis([-3 3 -0.1 1.1]), ...
title('Time-Reversed Signal, x(-t+1)')
subplot(4,1,4),plot(t,x(3/2*t+1)),axis([-3 3 -0.1 1.1]), ...
title('Time-Scaled Signal, x(3/2 t +1)')

Note: Ignore the ... when typing the code in Matlab.

Time t needs to start somewhere and end somewhere. The signal starts at 0
and ends at 2. We need to be careful with time as we want to include the
signal after the transformation of the independent variable to be displayed
correctly. Therefore, we started the time from −3 to 3 with a step size of
0.001.

The subplot function allows to see the original signal and transformed signals
to be display in the same Figure. subplot(4, 1, 1) indicates that the figure is
divided into 4 rows and 1 column. The last 1 indicates the placement of the
plot inside the figure.

3
plot(t, x(t)) will plot x(t) in the location specified by the subplot function.
The axis function controls the plot of the signal to be from −3 to 3 on the
x − axis and from −0.1 to 1.1 on the y − axis. This is important for the
comparison of the different transformations.

Figure 1 shows the plot of x(t) in the first row. The second row is the plot
of x(t + 1). The signal x(−t + 1) is displayed in the third row. The last row
shows x( 32 t + 1).

Figure 1: Transformation of the independent variable

4
4.2 Student Task 1 - Plot a continuous-time signal
Task 1. Plot the signal given by

 0, t ≤ 0

t + 1, 0 ≤ t ≤ 1
x1 (t) =


 1, 1 ≤ t ≤ 2
0, t ≥ 2

Add appropriate label(s) and title(s). Write the code, print and paste the
figure(s) here.

5
4.3 Student Task 2 - Apply transformation of the in-
dependent variable
Task 2. For x1 (t) plotted in the previous section, plot x1 (t + 4), x1 ( 31 t − 3)
and x1 (−2t + 4). Add appropriate label(s) and title(s). Write the code, print
and paste the figure(s) here.

6
4.4 Student Task 3 - Write code for a plotted signal
Task 3. Write Matlab code for the continuous-time signal, x2 (t), shown in
Figure 2.

Figure 2: x2 (t)

7
4.5 Student Task 4 - Transformation of the indepen-
dent variable of the plotted signal
Task 4. For x2 (t) plotted in the previous section, plot x2 (t + 3), x2 (t − 4),
x2 (2t − 2) and x2 (− 21 t + 1). Add appropriate label(s) and title(s). Write the
code, print and paste the figure(s) here.

You might also like