0
$\begingroup$

I am trying to write a matlab function that calculates the coefficient of thermal expansion of water from a given temperature. From what I understand the thermal expansion coefficient is calculated as the degree of expansion divided by the change in temperature, expressing the tendency of a fluid to change in volume with a change in temperature.

The following code calculates this in matlab:

T = 20; % initial temperature
dT = 0.001; % change in temperature °C
V = 1; % volume m^3

rho1 = waterDensity(T); % density of temperature
rho2 = waterDensity(T+dT);% density of second temperature

V2 = rho1./rho2;
alpha = (V2-V)/dT; % coefficient of thermal expansion in deg C-1

where waterDensity is an external function that calculates the density of water in kgm-3 from a given temperature. Here, I'm having trouble making sense of this, mostly I don't understand why we need the line that starts with V2. I would have though that if mass is conserved the volume is given by the density so alpha should be calculated by the change in density divided by the change in temperature i.e.

alpha = (rho - rho1) ./ dT

Could anyone explain to me why this isn't the case.

I know that the first method works because it gives the same result as:

alpha = 1.6e-5 + 9.6e-6 .* T;

which is commonly used in the literature.

$\endgroup$
2
  • 1
    $\begingroup$ Hi user. I think you know how we use our homework tag. You can have a look at the definition before asking me, "Why have you retagged this to homework?" ;-) $\endgroup$ May 2, 2013 at 15:24
  • $\begingroup$ 'guide the asker to the answer rather than giving it away outright'. $\endgroup$
    – Emma
    May 2, 2013 at 17:30

1 Answer 1

1
$\begingroup$

Are you sure that the first block of code is correct? V2 should have been multiplied by V. You get correct values here only because you assumed V=1.

No, the difference in volumes isn't equal (or even in linear proportion) to difference in densities because they have an inverse relation. In terms of densities you have: $\alpha = {m (\frac 1 \rho - \frac 1 \rho_1) \over dT}$

$\endgroup$
3
  • $\begingroup$ This works: alpha = rho2.*(((1./rho2) - (1./rho1))./dT); Does that make sense? $\endgroup$
    – Emma
    May 3, 2013 at 6:10
  • $\begingroup$ No, this one works because you get V=1 again so mass is equal to density. For volumes other than unity it's incorrect. $\endgroup$
    – Azad
    May 3, 2013 at 7:25
  • $\begingroup$ But I would have though that volume = mass x density and since mass is conserved it can be ignored here. $\endgroup$
    – Emma
    May 3, 2013 at 9:03

Your Answer

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

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