Testing Linearity & Time Invariance

20 Ansichten (letzte 30 Tage)
Dru Lopez
Dru Lopez am 24 Mär. 2019
Kommentiert: Baba Maligeli am 8 Okt. 2020
Hello all,
So I have this small assignment for my systems and signals class where i need to take a group of equations and test them for linearity and time invariance. Well I have something thats working for the simple functions we have to test for but there are a few that im struggling to figure out. If anyone could point me in the right direction I'd greatly appreciate it. The functions to test are as follows:
1) y(t) = 2x(t)
2) y(t) = x(t) + 1
3) y(t) = ln(x(t))
4) y(t) = x(t)*x(t)
5) y'(t) + 2y(t) = 2x(t)
6) y(t) = x(t)*u(t)
7) y(t) = tu(t)
I am able to test 1-4, but 5-7 are the ones I'm struggling on
below is the code I got working for the simple functions.
function plotlti(T)
% LTI Check linearity and time invariance of systems
% T is a string which gives the transformation of the system
% i.e. T = '2*x' would indicate y(t)=2*x(t)
%
% Your Name Date
additivity(T);
scaling(T);
TI1(T);
TI2(T);
end
function additivity(T)
clf
t1 = -5:0.05:5; % fine time scale
t2 = -5:0.5:5; % coarse time scale
% Additivity Experiment #1
x1 = u(t1); % create two steps
x2 = u(t1);
x = x1 + x2; % add them
e1 = eval(T); % apply transformation
% Additivity Experiment #2
x = u(t2); % create a step
y1 = eval(T); % transform it to form y1
y2 = y1; % use the same output as y2
e2 = y1 + y2; % add them up
plot(t1,e1);
hold on;
plot(t2,e2);
end
function scaling(T)
clf
t1 = -5:0.05:5; % fine time scale
t2 = -5:0.5:5; % coarse time scale
% Scalability Experiment #1
x1 = 2*u(t1); % scale step function by a factor of 2
x = x1; % make x = to the scaled x(t)
e1 = eval(T); % apply transformation for the scaled x(t)
% Additivity Experiment #2
x = u(t2); % create a step
y1 = eval(T); % transform it to form y1
e2 = 2*y1; % make e2 our scaled y(t) by a factor of 2
plot(t1,e1);
hold on;
plot(t2,e2);
end
function TI2(T)
clf
t1 = -5:0.05:5; % fine time scale
t2 = -5:0.5:5; % coarse time scale
% TI -1s Experiment #1
x= u(t1-1); % shift the step function to the right 1s
e1 = eval(T); % apply transformation for the shifted x(t)
% Additivity Experiment #2
x = u(t2); % create a step
y1 = eval(T); % transform it to form y1
e2 = y1; % make e2 our y(t)
plot(t1,e1);
hold on;
plot(t2+1,e2);
end
function TI1(T)
clf
t1 = -5:0.05:5; % fine time scale
t2 = -5:0.5:5; % coarse time scale
% TI -1s Experiment #1
x= u(t1+1); % shift the step function to the right 1s
e1 = eval(T); % apply transformation for the shifted x(t)
% Additivity Experiment #2
x = u(t2); % create a step
y1 = eval(T); % transform it to form y1
e2 = y1; % make e2 our y(t)
plot(t1,e1);
hold on;
plot(t2-1,e2);
end

Antworten (1)

Baba Maligeli
Baba Maligeli am 8 Okt. 2020
Y(n)=x^2(n)
  1 Kommentar
Baba Maligeli
Baba Maligeli am 8 Okt. 2020
Answer it if possible to check time invariance

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by