Ts = % INSERT CODE HERE;  % Periodos deigmatolhpsias
t = 0:Ts:2;               % Dianysma xronou t
x = ones(size(t));        % Eisodos x(t) = u(t)

% Theorhtikh lysh diaforikhs (t einai 8etiko e3' orismou)
y_theory = % INSERT CODE HERE;

% Proseggistikh lysh
y = zeros(size(t));       % Desmeysh mnhmhs

y(1) = 0;                 % Arxikh timh
for n = 1:length(y)-1     % For loop gia ylopoihsh diaforikhs
    y(n+1) = % INSERT CODE HERE;
end

% Grafhmata
clf; subplot(211);
plot(t, y_theory ,'-', t, y, 'r.-'); grid;
title('Exact and approximate solutions for RC circuit');
xlabel('Time (s)');
ylabel('Amplitude');
legend('Exact solution', 'Approximate solution', 'Location', 'SouthEast');

% Ypologismos sfalmatos se pososto epi tois ekato
err_pct = (y - y_theory)./(y_theory)*100;
subplot(212);
plot(t(2:length(t)), err_pct(2:length(t)), 'r.-'); grid
title('Percent approximation error');
xlabel('Time (sec)');
ylabel('Error (%)');