function dydt = cooling_deriv ( t, y )

%*****************************************************************************80
%
%% cooling_deriv() evaluates the right hand side of cooling_ode().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 May 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real T: the time, in seconds.
%
%    real Y: the temperature, in degrees K.
%
%  Output:
%
%    real DYDT: the rate of change of temperature, in degrees K per second.
%

%
%  h heat transfer coefficient W/(m^2 K) = J/(s m^2 K)
%  area in square meters
%  mass in kilograms.
%  specific heat in J/(kg-K)
%  Y in degrees K
%  T time in seconds
%
  [ area, h, mass, specific_heat, t0, y0, tstop ] = cooling_parameters ( );
  y_ambient = ambient_temperature ( t );

  dydt = - h * area * ( y - y_ambient ) / mass / specific_heat;

  return
end

