Lab 3
Lab 3
SOFTWARE/HARDWARE REQUIRED.
Personal Computer with MATLAB installed.
THEORY/ BACKGROUND
Basic operations
There are three basic operations performed on signals in a complex system. Before one models
complex signals and systems, he must understand the mathematical representation and physical
effect of these operations on signals.
Time Scaling
The time scaled version of x(t) is represented mathematically as x(bt), where b is the scale factor
and is always greater than 0. Further, there are two possibilities; i.e., either b<1 or b>1. If b<1,
the resulting scaling is called Expansion, and the resulting signal is called Expanded Signal.
Conversely, if b>1, the resulting scaling is called Compression, and the resulting signal is called
Compressed Signal.
Time Reversal
The time reversed version of x(t) is represented mathematically as x(-t), where minus sign shows
the time reversal. The resulting signal is called Time Reversed Signal.
THE BENAZIR BHUTTO SHAHEED UNIVERSITY OF TECHNOLOGY & SKILL
DEVELOPMENT KHAIRPUR MIR’S
Time Shifting
The time shifted version of x(t) is represented mathematically as x(t-t1), where t1 is the amount
of time by which the signal is delayed. The time shift is called Delay, if t1>0 and it is called
Time Advance if t1<0. If t1>0, the resulting signal is called Time Delayed Signal. Conversely,
if t1<0, the resulting signal is called Time Advanced Signal.
Programs
Program 1
Following Matlab program plots function x(t)=sawtooth(wt), its compressed version x(2t), and
its expanded version x(0.5t).
f=1;
w=2*pi*f;
t=-5:0.01:5;
b = 2;
x = sawtooth(w*t);
x1 = sawtooth(w*b*t);
b=0.5;
x2 = sawtooth(w*b*t);
plot(t, x, 'red', t, x1,'green', t, x2, 'blue');
axis([-3 3 -5 5]);
THE BENAZIR BHUTTO SHAHEED UNIVERSITY OF TECHNOLOGY & SKILL
DEVELOPMENT KHAIRPUR MIR’S
Program 2
Following Matlab program generates and plots function x(t)=et, and its time reversed version
x(-t).
clear all; clc
t=-3:0.01:3;
x = exp(t);
xrev= exp(-t);
plot(t, x, 'red', t, xrev, 'blue');
axis([-3 3 0 5]);
Program 3
Following Matlab program plots function x(t)=e-3t, its time delayed x(t-1), and its time advanced
version x(t+1).
t=-3:0.01:3;
t1=1;
a=3;
x=exp(-a*t);
x1=exp(-a*(t-t1));
x2=exp(-a*(t+t1));
plot(t,x,'red',t,x1,'green',t,x2,'blue');
axis([-3 3 0 5]);
grid on
THE BENAZIR BHUTTO SHAHEED UNIVERSITY OF TECHNOLOGY & SKILL
DEVELOPMENT KHAIRPUR MIR’S
Procedure
Type these three programs; program 1, program 2, and program 3 and save them with filenames
prog1, prog2, prog3 respectively, and then run them.
Observation
Attach the plots you obtained from the above mentioned programs and also for the programs
mentioned in exercises below and comment.
EXERCISE 1
Write a Matlab program, which generates and plots function x(t)=sin(2fot), its delayed version
x(t-0.2) and, compressed version of the delayed signal, i.e., x(2t-0.2), and expanded version of
the delayed signal i.e., x(0.5t-0.2). Keep f0=1.
f0=1;
t=0:0.01:10;
t1=0.2;
x=sin(2*pi*f0*t);
x1=sin(2*pi*f0*t-t1);
x2=sin(2*pi*f0*2*t-t1);
x3=sin(2*pi*f0*0.5*t-t1);
subplot(4,1,1);
plot(t,x);
xlabel('Sin w t')
subplot(4,1,2);
plot(t,x1);
xlabel('Sin w t-t1')
subplot(4,1,3);
plot(t,x2);
xlabel('Sin w 2t-t1')
subplot(4,1,4);
THE BENAZIR BHUTTO SHAHEED UNIVERSITY OF TECHNOLOGY & SKILL
DEVELOPMENT KHAIRPUR MIR’S
Exercise 2
Plot the continuous time signal x(t) = t/(t2 + 4). Plot the following:
1. x(1.5t) 2. x(0.8t)
3. x(t+3.6) 4. x(2t-1)
t=-20:0.01:20;
y=t./(t.^2+4);
plot(t,y,'blue')
xlabel('t');
ylabel('f(t)');
title('function of t');
THE BENAZIR BHUTTO SHAHEED UNIVERSITY OF TECHNOLOGY & SKILL
DEVELOPMENT KHAIRPUR MIR’S
1. x(1.5t)
1. x(1.5t)
t=-20:0.01:20;
t2=(1.5*t)
y2=t2./(t2.^2+4);
y1=t./(t.^2+4);
plot(t,y1,'blue',t,y2,'black')
xlabel('t');
ylabel('f(t)');
title('funtion of t');
legend('f(t)','f(t*1.5)')
2. x(0.8t)
t=-20:0.01:20;
t2=(t*0.8)
y1=t./(t.^2+4);
y2=t2./(t2.^2+4);
plot(t,y1,'blue',t,y2,'black')
xlabel('t');
ylabel('f(t)');
title('function of t');
legend('f(t)','f(0.8*t')
THE BENAZIR BHUTTO SHAHEED UNIVERSITY OF TECHNOLOGY & SKILL
DEVELOPMENT KHAIRPUR MIR’S
3. x(t+3.6)
t=-20:0.01:20;
t2=(t+3.6)
y1=t./(t.^2+4);
y2=t2./(t2.^2+4);
plot(t,y1,'blue',t,y2,'black')
xlabel('t');
ylabel('f(t)');
title('function of t');
legend('f(t)','f(t+3.6)')
THE BENAZIR BHUTTO SHAHEED UNIVERSITY OF TECHNOLOGY & SKILL
DEVELOPMENT KHAIRPUR MIR’S
4. x(2t-1)
t=-20:0.01:2;
t2=(2*t-1)
y1=t./(t.^2+4);
y2=t2./(t2.^2+4);
plot(t,y1,'blue',t,y2,'black')
xlabel('t');
ylabel('f(t)');
title('function of t');
legend('f(t)','f(t*2-1)')
Lab Submission: Attach the prints of the plots you obtained in the exercises above with proper
headings including the function name and description.