%
%  analytical solutions
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Problem 1
%
%
  x = @(t) 0*(t<0)-0.002*((t>=0)&(t<0.2))...
      +0.004*((t>=0.2)&(t<0.3))-0.003*(t>=0.3);
  ya = @(t) 0*(t<0)+(2.166*exp(-t/0.0833)-1.666).*((t>=0)&(t<0.2)) ...
               +(-4.898*exp(-(t-0.2)/0.0833)+3.332).*((t>=0.2)&(t<0.3))...
               +(4.357*exp(-(t-0.3)/0.0833)-2.50).*(t >=0.3)
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   Problem 2
% 
  x = @(t) 0*(t<0)+1*((t>=0)&(t<0.0006))...
      -2*((t>=0.0006)&(t<0.002))+6*(t>=0.002);
  ya = @(t) 0*(t<0)+(-0.01*exp(-t/0.000375)+0.01).*((t>=0)&(t<0.0006)) ...
               +(0.02798*exp(-(t-0.0006)/0.000375)-0.02).*((t>=0.0006)&(t<0.002))...
               +(-0.07933*exp(-(t-0.002)/0.000375)+0.06).*(t >=0.002)
