1
$\begingroup$

I plotted an energy curve from the following points:

{0.01,0.6004},{0.1,0.6354},{0.5,1.032},{1.1,1.8516},{1.5,2.4167},{2.0,3.1576}

What I want to do is compute the heat capacity form this curve by calculating the slope along the curve at various points and plotting the results. I tried using the following code:

heatcap[t]=(energy[t+.01]-energy[t])/.02;
Plot[heatcap[t],{t,0.2,1.99}]. 

All that I got from this was a grid and no points. I am really baffled by this and need some guidance.

$\endgroup$
0

1 Answer 1

1
$\begingroup$

Since you did not give an explicit explanation of you data list, I suppose they are in the form of (temperature, energy) with SI unit.

energyVsTemperature = {{0.01,0.6004}, {0.1,0.6354}, {0.5,1.032}, {1.1,1.8516}, {1.5, 2.4167}, {2.0, 3.1576}};
experimentData = ListPlot[energyVsTemperature, PlotStyle -> {Red, PointSize[.02]}];

Instead of your formula heatcap[t]=(energy[t+.01]-energy[t])/.02, I will use the derivative of an interpolation function for energyVsTemperature to calculate the heat capacity.

Firstly, an interpolation function for heat capacity, i.e. heatCap, is made with Interpolation[...]:

heatCap = Interpolation[energyVsTemperature];
interpolatedHeatCapPlot = Plot[heatCap[t], {t, 0.01, 1.99}, PlotStyle -> Blue]

enter image description here

Validate our interpolation function for heat capacity:

Show[{experimentData, interpolatedHeatCapPlot}, Frame -> True, 
    FrameLabel -> {"Temperature", "Energy"}, 
    Epilog -> Inset[Column[{
        LineLegend[{Blue}, {"Interpolated function"}], 
        PointLegend[{Directive[Red, PointSize[0.02]]}, {"Experiment data"}]}], 
      Scaled[{.8, .3}]]]

enter image description here

We can use Manipulate[...] to obtain the heat capacity at each Temperature:

Manipulate[Show[{experimentData, interpolatedHeatCapPlot, Graphics[{PointSize[.03], Point[{loc[[1]], heatCap[loc[[1]]]}]}]}, 
  Frame -> True, FrameLabel -> {"Temperature", "Energy"}, PlotLabel ->"Current heat capacity = " <> ToString[D[heatCap[t], t] /. t -> loc[[1]]],
  ImageSize -> {480, 320}, Epilog -> {Inset[Column[{
      LineLegend[{Blue}, {"Interpolated function"}],
      PointLegend[{Directive[Red, PointSize[0.02]]}, {"Experiment data"}]}],
    Scaled[{.8, .3}]]}],
  {{loc, {0.3, heatCap[0.3]}}, Locator, Appearance -> None}, AppearanceElements -> None]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.