4. Using theory to correlate data.

advertisement

W.R. Wilcox, Clarkson University, 4 May 2005

4. Using theory to correlate data

We learned in unit 3 that correlating data using polynomials has limitations and dangers. It is always far better to fit using an equation with a theoretical basis. For vapor pressure data, that basis is the Clapeyron equation , ln(P) = A - B/T (4.1) where A and B are constants to be obtained by fitting the data. Note that this equation is not dimensionally consistent, so the values of A and B depend on the units used for P and T. (The same is true for the constants obtained to fit polynomials.)

If you have closed and then re-opened MATLAB since our last session, you will have to reimport the data. In the Command window, click on File, Import Data . Select COvapP.dat and import it. Again, select the column vectors for P and T via:

>> T = data(: , 3); P = data(: , 1);

To fit these data using equation 4.1, we must generate new vectors for ln(P) and 1/T:

>> lnP = log(P) ; recT = 1./T ; scatter(recT, lnP)

>> xlabel('1/T (K^-^1)'), ylabel('ln(P) (P in Pa)')

>> title('ln vapor pressure CO versus 1/T')

Note that the dot is necessary before / to take the reciprocal of T. Alternate plotting commands are plot(recT, lnP, 'o') and scatter(1./T, log(P)), among others. Try them, then save your figure using a new name.

Proceed as in 3 , fitting the ln(P) versus 1/T plot using the Basic

Fitting tool in the Figure window. This produces Figure

4.1, which demonstrates that the

Clapeyron equation is reasonably valid for the vapor pressure of pure carbon monoxide. It also shows that the best (least squares) value for A is 21.248 and for B 812.54.

Using the methods in 3 make a residuals plot and calculate r

2

.

The results are given on the next page.

Figure 4.1. ln(P) versus 1/T for CO.

1

The residuals plot is given here as Figure 4.2. The value of r 2 for the fit of ln(P) to 1/T is

0.99438. This is a considerable improvement over any polynomial fit, with many fewer constants than the higher order polynomials. Furthermore it has some theoretical significance and can be much more safely extrapolated beyond the experimental range of temperatures.

Now prepare a semilogarithmic plot (as in 3 ) of experimental values of P as points and the predicted values of P in a line using the Clapeyron equation with the values we just found for

Figure 4.2. Residuals for fit to Clapeyron equation.

A and B.

>> Pp = exp(- 812.54./T + 21.248);

>> semilogy(T, P, 'o', T, Pp)

>> xlabel('Temperature (K)'), ylabel('Vapor pressure (Pa)')

>> title('Fit of CO vapor pressure to the Clapeyron equation')

The result is shown in Figure 4.3.

As good as it is, the Clapeyron equation is still not quite satisfactory.

Note that in Figure 4.2 the residuals are positive for intermediate values of temperature, and negative for high and low values. Put differently, the

Clapeyron curve in Figure 4.3 is below the data points for intermediate temperature, and above the data points at high and low temperatures.

This causes some concern, particularly for extrapolation.

Consequently, the Antoine equation was developed and is examined in 5.

Using a semi-empirical equation to correlate data .

Figure 4.3. CO vapor pressure fit to the Clapeyron equation.

2

Download