Lab 05-Study of Systems Using MATLAB
Lab 05-Study of Systems Using MATLAB
Lab 05-Study of Systems Using MATLAB
[Spring 2012]
upon the present and past values of x(t ) . So, if the input to a causal system is zero for t t0 , the
output of the system is also zero for t t0 . Correspondingly a discrete time signal is causal if its
output y[ n0 ] at time n n0 depends only on the values of input signal x[ n] for n n0 . All natural
systems are causal.
Example:
Suppose the system S1 is described by the I/O relationship y(t ) x (t 1) while the I/O relationship
of the system S 2 is given by y (t ) x(t 1) . Using the input signal x(t ) u (t ) u (t 1) find out if the
two systems are causal.
Commands
t1=-3:0.1:0;
x1=zeros(size(t1));
t2=0:0.1:1;
x2=ones(size(t2));
t3=1:0.1:3;
x3=zeros(size(t3));
t=[t1 t2 t3];
x=[x1 x2 x3];
plot(t,x,'linewidth',2),grid on
ylim([-0.1 1.1]);
legend('x(t)')
plot(t-1,x,'linewidth',2),grid on
ylim([-0.1 1.1]);
legend('y_1(t)')
plot(t+1,x,'linewidth',2),grid on
ylim([-0.1 1.1]);
legend('y_2(t)')
Results
Comments
Definition of the graph in the
time interval 3 t 3 of the
input signal x(t ) u (t ) u (t 1)
[Spring 2012]
dynamic or dynamical.
Example:
Using the input signal x(t ) u (t ) u (t 1) find out the systems described by the I/O relationship
y (t ) 3 x(t ) and y(t ) x(t ) x (t 1) are static or dynamic.
Commands
Results
t1=-3:0.1:0;
x1=zeros(size(t1));
t2=0:0.1:1;
x2=ones(size(t2));
t3=1:0.1:3;
x3=zeros(size(t3));
t=[t1 t2 t3];
x=[x1 x2 x3];
plot(t,x,'linewidth',2),grid on
ylim([-0.1 1.1]);
legend('x(t)')
plot(t,3*x,'linewidth',2),grid on
ylim([-0.1 3.1]);
legend('y(t)')
Comments
Definition of the graph in the
time interval 3 t 3 of the
input signal x(t ) u (t ) u (t 1)
In order to determine if the second system described by the I/O relationship y(t ) x(t ) x (t 1) is
static or dynamic, recall that x(t ) u (t ) u (t 1) 1,0 t 1; thus x(t 1) u (t 1) u (t 2) 1,1 t 2
and so y(t ) u (t ) u (t 2) 1, 0 t 2 . The values of y (t ) depend on past values of x(t ) so system is
dynamic.
5.1.3 Linear and Non-linear Systems:
Let y (t ) denote the response of the system S to an input signal x(t ) , that is, y (t ) S{ x (t )} . System S
is linear if for any input signal s x1 (t ) and x2 (t ) and any scalar a1 and a2 the following relationship
(equation 5.1) holds.
[Spring 2012]
the additivity property and the homogeneity property. A system S satisfies the additivity
property if for any input signals x1 (t ) and x2 (t )
S{ x1 (t ) x2 (t )} S {x1 (t )} S{ x2 (t )}
While the homogeneity property implies that for any scalar a and any input signal x(t ) ,
S{ax (t )} aS{x(t )}
Example:
Let x1 (t ) u (t ) u (t 1) and x2 (t ) u (t ) u (t 2) be the input signals to the systems described by the
I/O relationships y(t ) 2 x(t ) and y (t ) x 2 (t ) . Determine if the linearity property holds for these
two systems.
To examine if the systems are linear, we use the scalars a1 2 and a2 3. The time interval
considered is 3 t 3 .
For the system described by the I/O relationship y(t ) 2 x(t ) the procedure is followed as
Commands
t=-3:0.1:3;
x1=heaviside(t)-heaviside(t-1);
x2=heaviside(t)-heaviside(t-2);
%computation of the left side of equation 5.1
a1=2;
a2=3;
z=a1*x1+a2*x2;
y=2*z;
plot(t,y,'linewidth',2),grid on
ylim([-1 11])
Results
Comments
Definition of the input signals
x1 (t ) and x2 (t )
The expression a1 x1 (t ) a2 x2 (t )
is defined.
The left side of equation 5.1,
namely,
S{a1 x1 (t ) a2 x2 (t )} is
computed and the result is
plotted.
Definition of S{ x1 (t )} and
S{x2 (t )} .
The right side of equation 5.1,
namely, a1S {x1 (t )} a2 S{x2 (t )} is
computed and the result is
plotted.
The two graphs obtained are identical; hence the two sides of equation 5.1 are equal. Therefore the
system described by the I/O relationship y(t ) 2 x(t ) is linear.
3
[Spring 2012]
x(t ) , then the system response to the input signal x (t t0 ) is y(t t0 ) . The mathematical expression
(equation 5.2) is
y(t t0 ) S{x(t t0 )}
Equivalently, a discrete time system is time or (more appropriately) shift invariant if
y[n n0 ] S{x[n n0 ]}
From the above equations, we conclude that is a system is time invariant, the amplitude of the
output signal is the same independent of the time instance the input is applied. The difference is
time shift in the input signal. A non-time invariant system is called time-varying or time-variant
system.
Example:
Suppose that response of a system S to an input signal y(t ) tet x(t ) . Determine if the system is
time invariant by using the input signal x(t ) u (t ) u (t 5) .
In order to determine if the system is time invariant, first we will have to compute and plot the
system response y (t ) to the given input signal x(t ) u (t ) u (t 5) . Next, the computed output is
shifted by 3 units to the right to represent the signal y1 (t ) y(t 3) . This corresponds to the left side
of equation 5.2. As for the right side if equation 5.2, first the input signal x(t ) is shifted 3 units to
the right in order to represent the signal x(t 3) . Next, the system response y2 (t ) S {x(t 3)} is
computed and plotted. If the two derived system responses are equal, the system under
consideration is time invariant.
Commands
t=-5:0.001:10;
p=heaviside(t)-heaviside(t-5);
y=t.*exp(-t).*p;
plot(t,y,'linewidth',2),grid on
ylim([-0.05 0.4])
legend('y(t)')
Results
Comments
The response y (t ) of the system
to
the
input
signal
x(t ) u (t ) u (t 5) is
y(t ) tet u (t ) u (t 5) te t ,
0 t 5.
plot(t+3,y,'linewidth',2),grid on
ylim([-0.05 0.4])
legend('y(t-3)')
[Spring 2012]
Results
t=-5:0.001:10;
p=heaviside(t-3)-heaviside(t-8);
y=t.*exp(-t).*p;
plot(t,y,'linewidth',2),grid on
ylim([-0.01 0.2])
legend('S[x(t-3)]')
The two obtained graphs are not alike; thus the system described by the I/O relationship
y(t ) te t x (t ) is time variant. A rule of thumb is that if the output of the system depends on time t
Results
x= -4 -2 0 2 4
y2=x.^2;
Comments
Input signal x[ n]
y1= -12 -6 0 6 12
y2= 16 4 0 4 16
[Spring 2012]
Example:
Suppose that input signal x(t ) cos(2 t ) is applied to two systems described by the I/O
relationships y1 (t ) x 2 (t ) and y2 (t ) tx(t ) . Determine if the two systems are stable.
Commands
Results
t=0:0.01:10;
x=cos(2*pi*t);
plot(t,x,'linewidth',2), grid on
ylim([-2 2])
Comments
Definition and graph of x(t ) .
The input signal is bounded as
1 x(t ) 1, namely x(t ) is
bounded by M 1 as x(t ) M .
y1=x.^2;
plot(t,y1,'linewidth',2), grid on
ylim([-0.5 1.5])
Definition of graph of y1 (t ) .
The out signal y1 (t ) is bounded
as
0 y1 (t ) 1, namely y1 (t ) is
bounded by N 1 , as y1 (t ) N .
Hence the system described by
the
I/O
relationship
2
y1 (t ) x (t ) is BIBO stable.
Definition of the graph of y2 (t ) .
The output signal y2 (t ) is not
bounded as its amplitude is
getting larger as time passes.
Hence the system with I/O
relationship y2 (t ) tx(t ) is not
BIBO stable.
y2=t.*x;
plot(t,y2,'linewidth',2), grid on
In-lab Tasks
Task 01: Find out if the system described by the I/O relationship y(t ) x(t 4) is causal for the input
x(t ) u (t 1) u (t 2) and x(t ) u (t ) u (t 2) .
Task 02: Determine if the discrete-time systems described by I/O relationships y[n] x 2 [n] and
y[n] x[n 2] are static or dynamic. Use the input signal x[ n] [0 1 2 3 4], 1 n 3.
Task 03: Determine if the linearity property holds for discrete-time systems described by the I/O
relationships y[n] 2 x[ n] and y[ n] nx[n ]. Consider the signal x1[ n] 0.8n and x2 [n] cos(n), 0 n 5.
Task 04: Consider a system described by the I/O relationship y(t ) 1 2 x(t 1). Determine if this is
a time invariant system by using the input signal x(t ) cos(t ) u (t ) u (t 10) .
[Spring 2012]
Task 05: Suppose that input signal x(t ) sin(2 t ) is applied to two systems described by the I/O
relationships y1 (t ) x 3 (t ) and y2 (t ) t 3 x (t ) . Determine if the two systems are stable.
Post-lab Tasks
Task: Find out if the discrete-time systems described by the I/O relationship y[ n ] x[ n] and
y[ n] x[1 2n] are
a) Static or Dynamic (input signal x[ n] 2 n, 2 n 2 )
b) Causal or non-causal (input signal x[ n ] 2n, 2 n 2 )
c) Linear or non-linear (input signals x1[n] 2n, 2 n 4, x2 [ n] n 3, 2 n 4, a1 2 and a2 3 )
d) Shift invariant or shift variant (input signal x[ n] 2 n, 2 n 4 and shift n0 3 )