%% Question 9

tau1 = input('Enter a value for the first time constant:\n');
tau2 = input('Enter a value for the second time constant:\n');
start = input('Enter the start time:\n');
stop = input('Enter the end time:\n');

A = 1;
t = linspace(start, stop);
y1 = A * exp(-tau1 * t);
y2 = A * exp(-tau2 * t);
plot(t, y1, 'b', t, y2, 'r');
xlabel('time');
ylabel('y(t) = A * exp(-tau * t)');
title('exponential decay for two time constants');

s1 = sprintf('tau1 = %f', tau1);
s2 = sprintf('tau2 = %f', tau2);
legend(s1, s2);

% the decay rate increases as the time constant increases