0% found this document useful (0 votes)
14 views36 pages

Lab2 BMEF18 Signals

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)
14 views36 pages

Lab2 BMEF18 Signals

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/ 36

University of Thi-Qar

College of Engineering
BME-F18:SP1:Lab2: Signals

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni.

1
Signals Types
• Continuous Time Signal (CT):
The independent variable (time) is defined in a continuous interval.
Example: 1

t=0:.1:2*pi; 0.8

y=cos(t); 0.6

0.4

plot(t,cos(t)) 0.2

-0.2

-0.4

-0.6

-0.8

-1
0 1 2 3 4 5 6 7

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni.
2
Signals Types
• Discrete Time Signal (DT):
the independent variable (time) is defined in a discrete interval (e.g.,
the set of integer numbers). 1

Example: 0.8

n=0:10; 0.6

0.4

y=cos(n); 0.2

stem(n,y) 0

-0.2

-0.4

-0.6

-0.8

-1
0 1 2 3 4 5 6 7 8 9 10

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni.
3
Basic CT Signals
• Sinusoidal Signals
𝑥 𝑡 = 𝐴 cos 2𝜋𝑓𝑡 + 𝜙
𝐴: Amplitude
𝑓: The frequency
𝜙: The phase
1
𝑇 = : The period of the signal
𝑓

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni.
4
Basic CT Signals
• Sinusoidal Signals
Example: 𝜋
Plot the signal 𝑥 𝑡 = 3 cos 3𝜋𝑡 + in four periods.
2𝜋 2 3
= 3𝜋, which makes 𝑇 =
𝑇 3 3

A=3;
phi=pi/3; 2

T=2/3;
1
t=0:.01:4*T;

x(t)
x=A*cos(2*pi/T*t+phi); 0

plot(t,x) -1

xlabel(‘t’)
-2
ylabel(‘x(t)’)
-3
0 0.5 1 1.5 2 2.5 3
t

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni.
5
Basic CT Signals
• Exponential Signals
𝑥 𝑡 = 𝐴𝑒 𝑏𝑡
Example:
Plot the signals 𝑥1 𝑡 = 3𝑒 0.4𝑡 , and 𝑥2 𝑡 = 2𝑒 −0.9𝑡 for −2 ≤ 𝑡 ≤ 5
25

t=-2:.01:5; 20

x1=3*exp(.4*t); 15

x2=2*exp(-.9*t); 10

plot(t,x1,’b-’,t,x2,’r:’); 5

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by 0
-2 -1 0 1 2 3 4 5
Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A. Palamides and A. 6
Veloni.
Basic CT Signals
• Unit Step Function 0 𝑡<0
𝑢 𝑡 = ቐ0.5 𝑡 = 0
1 𝑡>0
The command ‘heaviside()’ is used to generate the unit step function.
Example:
1.2

Plot 𝑢(𝑡 − 5) for the interval 3 ≤ 𝑡 ≤ 9. 1

0.8

t=3:.01:9; 0.6

u=heaviside(t-5); 0.4

0.2

plot(t,u) 0

ylim([-.3 1.3]) -0.2

3 4 5 6 7 8 9

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni. 7
Basic CT Signals
• Unit Impulse or Dirac Delta Function
∞ 𝑡=0
δ 𝑡 =ቊ
0 𝑡≠0
The command ‘dirac()’ is used to generate the unit impulse function.
Example:
Plot 𝛿(𝑡 − 5) for the interval 3 ≤ 𝑡 ≤ 9. 1.2

t=3:.01:9; 0.8

0.6
The gap denotes infinite magnitude at t=5
u=dirac(t-5); % 0.4

plot(t,u)
0.2

ylim([-.3 1.3]) -0.2

3 4 5 6 7 8 9

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni. 8
Basic CT Signals
Example:
Show that the integration of dirac function is a unit step function.

syms t;
de=dirac(t);
u=int(de,t) u=heaviside(t)

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni.
9
Basic CT Signals
• Ramp Function
𝑡 𝑡≥0
𝑟 𝑡 =𝑡𝑢 𝑡 =ቊ
0 𝑡<0
To generate Ramp function, we first generate a unit step function, and then
multiply by ‘t’ 2

Example:
1.8

1.6

Plot Ramp function for the interval −2 ≤ 𝑡 ≤ 3 1.4

1.2

t=-2:.01:2; 1

0.8

r=t.*heaviside(t); 0.6

0.4

plot(t,r) 0.2

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni. 10
Basic CT Signals
• Rectangular Pulse Function 𝑇 𝑇
𝑇 𝑇
𝑝𝑇 𝑡 = 𝑢 𝑡 + −𝑢 𝑡− = ቐ1, − 2 ≤ 𝑡 ≤ 2
2 2
0, 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
Example:
Plot 𝑝3(𝑡) for the interval −3 ≤ 𝑡 ≤ 3 1.2

t=-3:.01:3; 1

T=3; 0.8

0.6

p3=heaviside(t+T/2)-heaviside(t-T/2); 0.4

plot(t,p3) 0.2

ylim([-.3 1.3]) -0.2

-3 -2 -1 0 1 2 3

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni. 11
Basic DT Signals
• Unit Impulse Sequence
1 𝑛 = 𝑛0
𝛿 𝑛 − 𝑛0 = ቊ
0 𝑛 ≠ 𝑛0
The command ‘gauspuls()’ can be used to generate unit impulse
sequence.
Example: 1

0.9

Plot the unit impulse sequence 𝛿[𝑛 − 5] for −1 ≤ 𝑛 ≤ 9


0.8

0.7

n=-1:9; 0.6

0.5

del=gauspuls(n-5);
0.4

0.3

0.2

stem(n,del) 0.1

0
-1 0 1 2 3 4 5 6 7 8 9

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni. 12
Basic DT Signals
• Unit Step Sequence
1 𝑛 − 𝑛0 ≥ 0
𝑢 𝑛 − 𝑛0 = ቊ
0 𝑛 − 𝑛0 < 0
• ‘heaviside()’ can not be used to generate unit step function?
We can generate unit step sequence by using piece-wise function definition.
Example:
Plot unit step sequence 𝑢[𝑛 − 5] for 0 ≤ 𝑛 ≤ 10 1

0.9

n1=0:4; 0.8

n2=5:10; 0.7

0.6
n=[n1 n2]; 0.5

u1=zeros(1,length(n1)); 0.4

0.3
u2=ones(1,length(n2)); 0.2

u=[u1 u2]; 0.1

stem(n,u) 0
0 1 2 3 4 5 6 7 8 9 10

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni. 13
Basic DT Signals
• Real Exponential Sequence
𝑥 𝑛 = 𝑎𝑛 , 𝑎 ∈ 𝑅𝑒𝑎𝑙
If 𝑎 > 1, 𝑥[𝑛] is ascending, if 𝑎 < 1, 𝑥[𝑛] is descending.
Example:
Plot 𝑥1 𝑛 = 0.8𝑛 , and 𝑥2 𝑛 = 1.2𝑛 for 0 ≤ 𝑛 ≤ 5
2.5

n=0:5;
2

x1=0.8.^n; x2=1.5.^n;
1.5

stem(n,x1); hold on;


1

stem(n,x2);
0.5

xlim([-1 6]);
0
-1 0 1 2 3 4 5 6

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems
14
Laboratory with MATLAB by A. Palamides and A. Veloni.
Basic DT Signals
• Sinusoidal Sequence
𝑥 𝑛 = 𝐴 cos 𝑤𝑛 + 𝜙
𝐴 is amplitude, 𝑤 is the angular frequency, and 𝜙 is the phase.
Example:
𝑛 𝜋 𝑛𝜋 𝜋
Plot 𝑥 𝑛 = 2 cos( + ), and 𝑦 𝑛 = 2 cos( + ) for 0 ≤ 𝑛 ≤ 20
2 4 6 4
n=0:20;
x=2*cos(n/2+pi/4); 2
x[n]
2
y[n]

y=2*cos(n*pi/6+pi/4); 1.5 1.5

stem(n,x) 1 1

legend(‘x[n]’); 0.5 0.5

figure, stem(n,y) 0

-0.5 -0.5

legend(‘y[n]’) -1 -1

-1.5 -1.5

-2
-2 0 2 4 6 8 10 12 14 16 18 20
0 2 4 6 8 10 12 14 16 18 20

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with 15
MATLAB by A. Palamides and A. Veloni.
Properties of Signals
• Periodic Signals
- A continuous-time signal 𝑥(𝑡) is periodic if there is a positive number 𝑇 such
that 𝑥 𝑡 = 𝑥 𝑡 + 𝑇 , ∀𝑡 ∈ 𝑅.
- If 𝑇 is the smallest positive value for which the previous relationship holds, then
𝑇 is called the fundamental period of the signal.
- A discrete-time signal is periodic if there is a positive integer number 𝑁 such
that 𝑥 𝑛 = 𝑥 𝑛 + 𝑁 , ∀𝑛 ∈ 𝑍.
- A sinusoidal sequence 𝑥 𝑛 = cos(𝑤𝑛 + 𝜙) is not always periodic.
- A discrete-time signal 𝑥[𝑛] is periodic if there are integer positive numbers 𝑚, 𝑁,
such that:
2𝜋𝑚
𝑤=
𝑁

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory
with MATLAB by A. Palamides and A. Veloni. 16
Properties of Signals
Example:
Verify that the signal 𝑥 𝑡 = sin(𝑡) is periodic by comparing the values
of 𝑥(𝑡) for 0 ≤ 𝑡 ≤ 2𝜋, and for 10 cycles.
t=linspace(0,2*pi,7);
x=sin(t); -0.0000 0.8660 0.8660 0.0000 -0.8660 -0.8660 -0.0000
T=2*pi; -0.0000 0.8660 0.8660 0.0000 -0.8660 -0.8660 -0.0000
-0.0000 0.8660 0.8660 0.0000 -0.8660 -0.8660 -0.0000
for k=1:10 -0.0000 0.8660 0.8660 0.0000 -0.8660 -0.8660 -0.0000
-0.0000 0.8660 0.8660 0.0000 -0.8660 -0.8660 -0.0000
xk(k,:)=sin(t+k*T); -0.0000 0.8660 0.8660 -0.0000 -0.8660 -0.8660 -0.0000
-0.0000 0.8660 0.8660 0.0000 -0.8660 -0.8660 -0.0000
end -0.0000 0.8660 0.8660 -0.0000 -0.8660 -0.8660 -0.0000
-0.0000 0.8660 0.8660 0.0000 -0.8660 -0.8660 -0.0000
-0.0000 0.8660 0.8660 -0.0000 -0.8660 -0.8660 -0.0000
Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with
MATLAB by A. Palamides and A. Veloni. 17
Properties of Signals
• Sum of Periodic Signals
Suppose that 𝑥1 (𝑡) and 𝑥2 (𝑡) are periodic signals with periods 𝑇1 and
𝑇2 , respectively. Let 𝑥 𝑡 = 𝑥1 𝑡 + 𝑥2 (𝑡). Then
𝑚𝑇1 = 𝑘𝑇2 = 𝑇 𝑤ℎ𝑒𝑟𝑒 𝑚, 𝑘 ∈ 𝑍
Example:
Plot the signal 𝑥 𝑡 = cos 𝑡 + sin(3𝑡) in time of three periods.
2𝜋
𝑇1 = 2𝜋, 𝑇2 = , for 𝑚 = 1, and 𝑘 = 3, we get 𝑇 = 2𝜋.
3
T=2*pi; 2

𝑇 ≈ 6.8 − 0.5 = 6.2 ≈ 2𝜋


t=0:0.1:3*T;
1.5

plot(t,cos(t)+sin(3*t)); 0.5

-0.5

-1

-1.5

-2
0 2 4 6 8 10 12 14 16 18 20

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with
MATLAB by A. Palamides and A. Veloni. 18
Properties of Signals
• Construction of Periodic Signals
The command “gensig()” is used to generate periodic sines, square
pulses, and unit pulses
[s,t]=gensig(type,T,td,ts),
type: ‘sin’ for a sine signal, ‘square’ for a rectangular periodic pulse,
and ‘pulse’ for periodic unit pulses.
T : period and
td: is the time duration of the signal.
ts: the spacing of the time samples. Default ts=1E-3 s.

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory
with MATLAB by A. Palamides and A. Veloni. 19
Properties of Signals
1

Example: 0.8

0.6

0.4

[s1,t]=gensig('sin',2*pi,4*pi,.01); 0.2

-0.2

plot(t,s1) -0.4

-0.6

-0.8

[s2,t]=gensig(‘square’,2,4,.01); -1
0 2 4 6 8 10 12 14
1.2

0.8

plot(t,s2) 0.6

0.4

[s3,t]=gensig(‘pulse’,2,10); 1.2

1
0.2

-0.2

plot(t,s3) 0.8

0.6
0 0.5 1 1.5 2 2.5 3 3.5 4

0.4

0.2

-0.2

0 1 2 3 4 5 6 7 8 9 10

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory
20
with MATLAB by A. Palamides and A. Veloni.
Properties of Signals
• Construction of Periodic Signals
0.04

0.035

- Construct one period. 0.03

- Repeat using ‘repmat()’ command. 0.025

Example: 0.02

0.015

tp=0:.01:1; 0.01

0.005

xp=tp.*exp(-10*tp); 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

plot(tp,xp) 0.04

0.035

x=repmat(xp,1,10); 0.03

t=linspace(0,10,length(x)); 0.025

0.02

plot(t,x) 0.015

0.01

0.005
Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli.
0 21
Textbook used: Signals and Systems Laboratory with MATLAB by A. Palamides and A. Veloni. 0 1 2 3 4 5 6 7 8 9 10
Properties of Signals
• Causal Signals
A signal 𝑥 𝑡 is causal if 𝑥 𝑡 = 0 for 𝑡 < 0
A signal 𝑥[𝑛] is causal if 𝑥 𝑛 = 0 for 𝑛 < 0
• Even and Odd Signals
A signal is even if 𝑥 𝑡 = 𝑥 −𝑡 − ∞ < 𝑡 < ∞
A signal is even if 𝑥 𝑛 = 𝑥 −𝑛 − ∞ < 𝑛 < ∞
A signal is odd if 𝑥 −𝑡 = −𝑥 𝑡 − ∞ < 𝑡 < ∞
A signal is odd if 𝑥 𝑛 − = −𝑥 𝑛 −∞<𝑛 <∞
All signals can be expressed as the sum of an odd signal 𝑥𝑜 𝑡 and an even
signal 𝑥𝑒 𝑡 by:
𝑥𝑒 = 0.5 𝑥 𝑡 + 𝑥 −𝑡
𝑥𝑜 = 0.5 𝑥 𝑡 − 𝑥 −𝑡
Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory
with MATLAB by A. Palamides and A. Veloni. 22
Properties of Signals
Example:
Separate the unit step sequence 𝑢 𝑡 in even and odd parts. Verify your outcome
by constructing the unit step sequence from its even and odd parts.
syms t; 1.5
heaviside(-t)/2 + heaviside(t)/2
0.6
heaviside(t)/2 - heaviside(-t)/2 heaviside(t)

u=heaviside(t); 0.4
1

1 0.8

un=subs(u,t,-t); 0.2

0.6

ue=.5*(u+un); 0.5 0

-0.2
0.4

uo=.5*(u-un); 0
-0.4
0.2

us=ue+uo; -0.5
-5 -4 -3 -2 -1 0
t
1 2 3 4 5
-0.6
-5 -4 -3 -2 -1 0
t
1 2 3 4 5 -5 -4 -3 -2 -1 0
t
1 2 3 4 5

t=-10:1:10;
uodd=0.5*(heaviside(t)-heaviside(-t));
ueven=0.5*(heaviside(t)+heaviside(-t));
Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with
MATLAB by A. Palamides and A. Veloni. 23
Properties of Signals
• Energy and Power Signals
𝑇 ∞
𝐸𝑥 = lim න 𝑥 𝑡 2 𝑑𝑡 =න 𝑥 𝑡 2 𝑑𝑡
𝑇→∞ −𝑇 −∞
if 𝐸𝑥 is finite, then 𝑥(𝑡) is energy signal.
𝑇
1 2 𝑑𝑡
𝑃𝑥 = lim න 𝑥 𝑡
𝑇→∞ 2𝑇 −𝑇
if 𝑃𝑥 is finite, then 𝑥(𝑡) is power signal.

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with
MATLAB by A. Palamides and A. Veloni. 24
Properties of Signals
• Energy and Power Signals
Example:
Find if the unit step function is power or energy signal?
((1/2*T)*
syms t T
u=heaviside(t);
d=int(abs(u)^2,-T,T);
Ex=limit(d,T,inf) Ex=infinity
Px=limit(1/(2*T)* d,T,inf) Px=0.50

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems
Laboratory with MATLAB by A. Palamides and A. Veloni.
25
Transformations of the Time Variable for
Continuous-Time Signals
• Time Reversal or Reflection
A signal 𝑦(𝑡) is a reflection or a reflected version of 𝑥(𝑡) about the
vertical axis if 𝑦 𝑡 = 𝑥 −𝑡 .
Example:
Suppose that 𝑥 𝑡 = 𝑡𝑒 −𝑡 , −1 ≤ 𝑡 ≤ 3. Plot the signal 𝑥 𝑡 .
t=-1:.1:3;
x=t.*exp(-t);
subplot(2,1,1)
plot(t,x)
subplot(2,1,2)
plot(-t,x)
Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory
with MATLAB by A. Palamides and A. Veloni. 26
Transformations of the Time Variable for
Continuous-Time Signals
• Time Scaling
A signal 𝑥1 (𝑡) is a compressed version of 𝑥(𝑡) if 𝑥1 𝑡 = 𝑥(𝑎𝑡), 𝑎
> 1.
A signal 𝑥2 (𝑡) is an expanded version of 𝑥(𝑡) if 𝑥2 𝑡 = 𝑥(𝑎𝑡), 0
< 𝑎 < 1.
Example:
Consider the continuous-time signal 𝑥 𝑡 = 𝑡𝑒 −𝑡 , 1 ≤ 𝑡 ≤ 3. We will
plot the signal 𝑥1 𝑡 = 𝑥(2𝑡), which is a time compression of x(t) by a
factor 𝑎 = 2; and the signal 𝑥2(𝑡) = 𝑥(0.5𝑡), which is a time
1
expansion of 𝑥(𝑡) by a factor 𝑎 = .
2

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory
with MATLAB by A. Palamides and A. Veloni. 27
t=-1:.1:3;
x=t.*exp(-t);
plot(t,x);
legend(‘x(t)’);

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory
with MATLAB by A. Palamides and A. Veloni. 28
% Compressed signal
%By a factor 1/a, a=2
Figure
plot(.5*t,x);
legend(‘x(2t)’);

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with
MATLAB by A. Palamides and A. Veloni. 29
% Expanded signal by a
%Factor 1/a, a = 0.5
Figure
plot(2*t,x);
legend(‘x(2t)’);

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with
MATLAB by A. Palamides and A. Veloni. 30
Transformations of the Time Variable for
Continuous-Time Signals
Time Shifting
A signal 𝑦(𝑡) is a time-shifted version of 𝑥(𝑡) if 𝑦 𝑡 = 𝑥(𝑡 − 𝑡0 ), where 𝑡0 is the time
shift.
Example: 𝑡
Plot the signal 𝑥 𝑡 − 3 , where 𝑥 𝑡 = ቊ −𝑡 𝑡 < 0 in the interval [-2,8]
𝑒
𝑒 𝑡≥0
t1=-5:.1:-.01;
t2=0:.1:5;
x1=exp(t1);
x2=exp(-t2);
t=[t1 t2];
x=[x1 x2];
plot(t,x)

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with
MATLAB by A. Palamides and A. Veloni. 31
Transformations of the Time Variable for
Continuous-Time Signals
plot(t+3,x)

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory
with MATLAB by A. Palamides and A. Veloni. 32
Transformations of the Time Variable for
Discrete-Time Signals
• Time shifting. This operation is similar to the continuous time
operation
• Time reversal is also similar to the operation performed for
continuous-time signals.
• Time scaling(NOT Required at this stage): This transformation is
different from the one described in the continuous time case.
- The downsampling operation is implemented in MATLAB by using
the command y=downsample(x,a), a is an integer.
- The time-expansion operation is called upsampling by the MATLAB
command y=upsample(x,1/a), 1/a is an integer.

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni. 33
Transformations of the Time Variable for
Discrete-Time Signals
Example:
x=[1 2 3 4 5];
a=2;
xds=downsample(x,2) xds= 1 3 5
a=1/2;
xup=upsample(x,1/a) xup= 1 0 2 0 3 0 4 0 5 0

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with MATLAB by A.
Palamides and A. Veloni. 34
Transformations of the Time Variable for
Discrete-Time Signals
- Another way to find 𝑥[−𝑛] is by using the command “fliplr()” as
follow:
Example:
Plot 𝑥1 𝑛 = 𝑥 −𝑛 , where 𝑥 𝑛 = 0.9𝑛 −2≤𝑛 ≤4
n=-2:4 n=-2 -1 0 1 2 3 4
n1=-fliplr(n) n1= -4 -3 -2 -1 0 1 2
x=.9.^n x= 1.2346 1.1111 1.0000 0.9000
0.8100 0.7290 0.6561
x1=fliplr(x) x1= 0.6561 0.7290 0.8100 0.9000
1.0000 1.1111 1.2346
Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with
MATLAB by A. Palamides and A. Veloni. 35
Transformations of the Time Variable for
Discrete-Time Signals stem(n,x);
title(‘x[n]');
figure
stem(n1,x1);
title(‘x[-n]');

x[n] x[-n]

Modified with permission by Ahmed Abdelhadi from 14:332:347 Signals and Systems Lab prepared by Ahmed Alhilli. Textbook used: Signals and Systems Laboratory with
MATLAB by A. Palamides and A. Veloni. 36

You might also like