clear; close all;
% Imie Nazwisko Indeks
% Grupa nr. 1, Wtorek, 7:30
% LAB 03

a = 2; b = 6; c = 4;
ut = 1; k = 2;
e = exp(1);
A1 = -3/2;
B1 = 3;
A2 = 3/2;
B2 = -5;
A3 = 1/2;
B3 = -1;

t = 0:.05:10;
xw = 1/2+t*0;
xs1 = A1*exp(-2*t)+B1*exp(-t);
xs2 = A2*exp(-2*t)+B2*exp(-t);
xs3 = A3*exp(-2*t)+B3*exp(-t);

%x1_t = (-3*e^(-2*t))/(2) + 3*e^(-t) + 1/2;
%x2_t = (3*e^(-2*t))/(2) + -5*e^(-t) + 1/2;
%x3_t = (e^(-2*t))/(2) + e^(-t) + 1/2;

subplot(2,2,1)
plot(t,(-3*exp(-2*t))/(2) + 3*exp(-t) + 1/2)
hold on;
grid on;
title("1. U(t)=1, *x(0)=0, x(0)=2"); xlabel("t"); ylabel("x(t)");
plot(t,xw, '--')
plot(t,xs1, '--')
hold on;
grid on;

subplot(2,2,2)
plot(t,(3*exp(-2*t))/(2) + -5*exp(-t) + 1/2)
hold on;
grid on;
title("2. U(t)=1, **x(0)=1, *x(0)=2"); xlabel("t"); ylabel("x(t)");
plot(t,xw, '--')
plot(t,xs2, '--')
hold on;
grid on;

subplot(2,2,3)
plot(t,(exp(-2*t))/(2) - exp(-t) + 1/2)
title("3. U(t)=1(t)"); xlabel("t"); ylabel("x(t)");
hold on;
grid on;
plot(t,xw, '--')
plot(t,xs3, '--')
hold on;
grid on;

subplot(2,2,4)
plot(t,(-3*exp(-2*t))/(2) + 3*exp(-t) + 1/2)
hold on;
plot(t,(exp(-2*t))/(2) - exp(-t) + 1/2)
hold on;
title("4. Wykresy: 1., 2., 3."); xlabel("t"); ylabel("x(t)");
plot(t,(3*exp(-2*t))/(2) + -5*exp(-t) + 1/2)
hold on;
grid on;

figure;
plot(t,(-1)*(exp(-2*t)) + exp(-1*t) )
% plot(t,(-1)*(exp(-2*t)) + exp(-1*t) + 1/2)
title("5. impuls"); xlabel("t"); ylabel("x(t)");
hold on;
grid on;