DSP_LAB_07_Linear Systems, Time-Invariance, and Signal Transformations
DSP_LAB_07_Linear Systems, Time-Invariance, and Signal Transformations
1. Objective
This lab is designed to help students:
Understand and verify the properties of linearity and time invariance in systems.
Distinguish between linear and non-linear systems.
Perform basic signal operations: time shifting, time scaling, and time reversal (flipping).
Visualize system behavior and transformations using MATLAB.
2. Theory
2.1 Linearity
A system is time-invariant if a shift in the input causes an identical shift in the output.
Mathematically:
If y[n] = T{x[n]}, then the system is time-invariant if T{x[n - n₀]} = y[n - n₀].
3. MATLAB Implementation
matlab
CopyEdit
1|Page
1
Digital Signal Processing -LAB Manual
%% Time Axis
n = -10:10;
%% Define Signal
x = double(n >= 0 & n <= 5); % A rectangular pulse
%% 1. Signal Transformations
x_shift = double((n - 3) >= 0 & (n - 3) <= 5); % x[n-3]
x_flip = double(-n >= 0 & -n <= 5); % x[-n]
x_scale = double(round(n / 2) >= 0 & round(n / 2) <= 5); % x[n/2] approx
figure('Name','Signal Transformations','NumberTitle','off');
subplot(2,2,1); stem(n, x, 'filled'); title('Original Signal x[n]'); grid on;
subplot(2,2,2); stem(n, x_shift, 'filled'); title('Time Shifted x[n-3]'); grid
on;
subplot(2,2,3); stem(n, x_flip, 'filled'); title('Time Reversed x[-n]'); grid on;
subplot(2,2,4); stem(n, x_scale, 'filled'); title('Time Scaled x[n/2]'); grid on;
%% 2. System Definitions
% System A: y[n] = x[n] + 2
% System B: y[n] = n * x[n]
% System C: y[n] = x[n] + x[n-1] (Linear and Time-Invariant - FIR)
% System C (FIR)
T = @(x) x + [0 x(1:end-1)]; % Causal FIR: x[n] + x[n-1]
% Apply system
y1 = T(x1);
y2 = T(x2);
y_comb = T(input_comb);
sum_y = a*y1 + b*y2;
% Compare results
figure('Name','Linearity Test (System C)','NumberTitle','off');
subplot(2,1,1); stem(n, y_comb, 'filled'); title('T{a·x1 + b·x2}');
subplot(2,1,2); stem(n, sum_y, 'filled'); title('a·T{x1} + b·T{x2}');
2|Page
2
Digital Signal Processing -LAB Manual
4. Lab Tasks
1. Use the plots to determine whether System C is linear and time-invariant.
2. Modify the system to y[n] = x[n]^2 and repeat the linearity test. Is the system still linear?
3. Try a different input signal (e.g., a sine or exponential) and repeat the signal transformations.
1. Define a new system: y[n] = sin(x[n]) and test whether it is linear and time-invariant.
Linearity Test:
Check:
ax1[n]+bx2[n]→y[n]=sin(ax1[n]+bx2[n]) ≠ a sin(x1[n]) + b sin(x2[n])
Time-Invariance Test:
Shift input:
Let x[n−n0] → y[n]= sin(x[n−n0])
Compare with shifting output:
Original output: y[n]=sin(x[n])
Shifted output: y[n−n0] =sin(x[n−n0])
Code:
n = -10:20;
3|Page
3
Digital Signal Processing -LAB Manual
% Plotting
figure;
subplot(4,1,1);
stem(n, x, 'filled');
subplot(4,1,3);
subplot(4,1,4);
4|Page
4
Digital Signal Processing -LAB Manual
x[n]
0.5
0
-10 -5 0 5 10 15 20
n
Time Shift: x[n - 4]
1
x[n - 4]
0.5
0
-10 -5 0 5 10 15 20
n
Time Flip: x[-n]
1
x[-n]
0.5
0
-10 -5 0 5 10 15 20
n
Combined: x[-n + 3]
1
x[-n + 3]
0.5
0
-10 -5 0 5 10 15 20
n
LTI systems are essential in DSP because their linearity and time-invariance simplify
analysis, design, and implementation. They enable efficient filtering, stable system behavior,
and straightforward use of tools like convolution and Fourier transforms.
5|Page
5