In: Electrical Engineering
Using MATLAB, determine whether the system below are a) linear/non-linear b) time-invariant/timevariant, c) causal/noncausal, d) has memory/memoryless:
y(t) = x(t) + x(t -1)
Provide MATLAB code and graphs to show your work for the linearity and time-invariance testing.
MATALB code is given below in bold letters.
clc;
close all;
clear all;
% Let the input be a unit step signal
t = (-1:0.01:10)';
x = 1*(t>=0); % Input is unit step signal
figure;plot(t,x);grid on;
xlabel('t');ylabel('Amplitude');title('Input signal');
ylim([-0.1 1.1*max(x)]);%ylim([-0.1 1.1]);
% Linearity test quection (a)
x_t_1 = 1*(t>=1);
y = x + x_t_1;
figure;plot(t,y);grid on;
xlabel('t');ylabel('Amplitude');title('Output signal');
ylim([1.1*(min(y)) 1.1*(max(y))]);
It is observed from the above figure that, the response y[t] for unit step is proportional to input. Therefore the system is linear.
% Time invariance test question (b)
% A Time invariant system output does not depend on when the input
is applied
t_shift = 0:0.01:11; % Shift in time
figure;plot(t_shift,y);grid on;
xlabel('t');ylabel('Amplitude');title('Output signal when the input
is applied at t = 0');
ylim([1.1*(min(y)) 1.1*(max(y))]);
It is observed from the above figure that, input at t= 0 has caused the output at t = 0. Therefore the systems output does not depend on when the input is appled. Hence the system is Time-Invariant.
% Test on causality
% A system is causal when the its unit Impulse response is zero for
n<0
% the systems output when the input is unit Impulse is given
below
x = 1*(t == 0); % unit Impulse
x_t_1 = 1*(t == 1);
h = x + x_t_1; % unit Impulse response
figure;plot(t,h);grid on;
xlabel('t');ylabel('Amplitude');title('Unit Impulse
response');
ylim([1.1*(min(h)) 1.1*(max(h))]);
It is observed from the above figure that, the system's output is zero for t<0 which indicates that system is causal.
% Question (d)
From the above figure it is observed that h[t] not equal to 0 for t>0 which indicate that the system is memory-system.