Assuming that the temperatures are given in Celsius and the energy required is for heating purposes, the energy required can be calculated by multiplying the mass of the substance being heated by its specific heat capacity and the change in temperature.
Here is an example code that accepts a 24x1 vector of temperatures and calculates the energy required:
main.m512 chars16 lines
Note that the mass and specific heat capacity values depend on the substance being heated. Also, delta_t is calculated as the difference between the maximum and minimum temperatures in the vector.
gistlibby LogSnag