function ode_6
% ode_6.m  solve  d^3/dt^3 + 2 d^2x/dt^2 + 3 dx/dt = 9t^2+24t+23
% initial conditions x(0)=4, x'(0)=3, X''(0)=4
% solution x(t) = t^3 + 2t^2 + 3t + 4   t in 0..2
  initial_x = 4;
  initial_dxdt = 3;
  initial_dxxdtt = 4;
  options = odeset('RelTol', 1e-4, 'AbsTol', [1e-4 1e-4 1e-5]);
  [t,x] = ode45(@rhs, [0 2], [initial_x, initial_dxdt, initial_dxxdtt], options);
  figure(1)
  plot(t,x(:,1));
  title('x(t)');
  xlabel('t');
  ylabel('x');
  grid on

  function dxxdtt=rhs(t,x)
    dxxdtt = zeros(3,1); % force column vector
    dxxdtt(1) = x(1);
    dxxdtt(2) = x(2);
    dxxdtt(3) =  -2*x(2) - 3*x(1) + 9*t*t + 24*t + 23;
  end % rhs
end % ode_6
