Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

SIGNALS & LINEAR SYSTEMS LABORATORY COURSE - EELE3110

PREPARED BY: ENG. SANABEL N. EL-HADDAD - TEACHING ASSISTANT AT


ISLAMIC UNIVERSITY OF GAZA
LAB (4) / LINEAR TIME-INVARIANT SYSTEMS
clear; % Clear all variables in the workspace
close all; % Close all open figure windows
clc; % Clear all text from the command window

OBJECTIVES:

• Use MATLAB to check if the system is LTI or not.

DEFINE SYMBOLIC VARIABLES

syms x(t) x1(t) x2(t) y(t) c t

DEFINE SOME ARBITARY INPUT SIGNALS TO BE USED FOR TESTING!!

x(t) = exp(2*t); % An arbitary choice for x(t)


x1(t) = exp(3*t); % An arbitary choice for x1(t)
x2(t) = 3*t^2; % An arbitary choice for x2(t)

EXAMPLE (1):

• Differniatiation is linear operator so the system is linear.


• There is no time scaling or multiplication or added terms depend on time, so the system is
time invariant.

sys1 = @(x) 3*diff(diff(x,t),t); % Define the input / output relationship

1) SCALING TEST (LAW OF HOMOGENEITY):


cy = c * sys1(x(t)) % c y(t)

cy =

y = sys1(c * x(t)) % Output due to c x(t)

y=

2) ADDITIVE TEST (LAW OF ADDITIVITY):

y1 = sys1(x1(t)) % Output due to x1(t) only

y1 =

y2 = sys1(x2(t)) % Output due to x2(t) only

y2 =

18

y3 = simplify(y1 + y2)

y3 =

y12 = sys1(x1(t) + x2(t)) % Output due to x1(t) + x2(t)

y12 =

3) TIME-INVARIANCE TEST:

check if the following equation holds or not


y(t) = sys1(x(t)); % y(t)
s1(t) = y(t-2)

s1(t) =

s2(t) =sys1(x(t - 2))

s2(t) =

EXAMPLE (2):

sys2 = @(x) sin(t) * x; % Define the input / output relationship

1) SCALING TEST:

cy = c * sys2(x(t)) % c y(t)

cy =

y = sys2(c * x(t)) % Output due to c x(t)

y=

2) ADDITIVE TEST:

y1 = sys2(x1(t)) % Output due to x1(t) only

y1 =
y2 = sys2(x2(t)) % Output due to x2(t) only

y2 =

y3 = simplify(y1 + y2)

y3 =

y12 = sys2(x1(t) + x2(t)) % Output due to x1(t) + x2(t)

y12 =

3) TIME-INVARIANCE TEST:

y(t) = sys2(x(t)); % y(t)


s1(t) = y(t-2)

s1(t) =

s1(t) = sys2(x(t - 2))

s1(t) =

EXAMPLE (3):

sys3 = @(x) sin(x); % Define the input / output relationship

1) SCALING TEST:

cy = c * sys3(x(t)) % c y(t)
cy =

y = sys3(c * x(t)) % Output due to c x(t)

y=

2) ADDITIVE TEST:

y1 = sys3(x1(t)) % Output due to x1(t) only

y1 =

y2 = sys3(x2(t)) % Output due to x2(t) only

y2 =

y3 = simplify(y1 + y2)

y3 =

y12 = sys3(x1(t) + x2(t)) % Output due to x1(t) + x2(t)

y12 =

3) TIME-INVARIANCE TEST:

y(t) = sys3(x(t)); % y(t)


s1(t) = y(t-2)

s1(t) =

s1(t) = sys3(x(t - 2))


s1(t) =

EXAMPLE (4):

sys4 = @(x) (t.^2.*x(t-2)); % Define the input / output relationship

1) SCALING TEST (LAW OF HOMOGENEITY):

cy = c * sys4(x) % c y(t)

cy =

y = sys4(c * x) % Output due to c x(t)

y=

2) ADDITIVE TEST (LAW OF ADDITIVITY):

y1 = sys4(x1) % Output due to x1(t) only

y1 =

y2 = sys4(x2) % Output due to x2(t) only

y2 =

y3 = simplify(y1 + y2)
y3 =

y12 = sys4(x1+ x2) % Output due to x1(t) + x2(t)

y12 =

3) TIME-INVARIANCE TEST:

check if the following equation holds or not

y(t) = sys4(x); % y(t)


s1(t) = y(t-2)

s1(t) =

x_s(t) = x(t - 2);


s2(t) =sys4(x_s)

s2(t) =

EXAMPLE (5):

TIME-INVARIANCE TEST:

Let us do this graphically

x(t) = sin(t);
sys5 = @(x) (x(t^2));
y(t) = sys5(x);
% Define an arbitary input

y(t) = sys5(x);
s1(t) = y(t-2)

s1(t) =
x_s(t) = x(t - 2);
s2(t) =sys5(x_s)

s2(t) =

h1 = fplot(s1(t), [-10, 10], 'r', 'LineWidth', 1.5);


hold on
h2 = fplot(s2(t), [-10, 10], 'b', 'LineWidth', 1.5);
title('Time-Invariance Test: y(t) = x(t^2)')
xlabel('t')
ylabel('Magnitude')
legend('Shiftted Input', 'Shiftted Output')
axis([-10 10 -1.2 1.2])
grid on

You might also like