% Unit 3 (MATLAB Course @ UAM)
% (c) Alexander Knebe

%============================
%       horse race
%============================

% you:      d  = 0.2 * t
% horse:    d  = 0.5 * (t-6)
%        -> d  = 0.5 * t - 3

% the linear system therefore is:
%     1*d - 0.2*t = 0
%     1*d - 0.5*t = -3

A = [1,-0.2;
     1,-0.5];
c = [0;-3];

solution = inv(A)*c;

d = solution(1);
t = solution(2);

fprintf(1,'you can run %f km before the horse catches up with you after %f seconds\n',d,t)

