You will need to enter two vectors into Matlab, P_TP and P_s. Then you will fit P_s/P_TP versus P_TP to a straight line and determine the temperature of the sample by extrapolating to zero pressure. The Matlab commands, and the response to those commands inside Matlab, will be printed here in
this font.
Start Matlab at the UNIX shell prompt by typing matlab.
ptp=[100;200;300;400;500]
ptp =
100
200
300
400
500
ps=[233.9;471.7;714.77;962.7;1215.4]
ps =
1.0e+03 *
0.2339
0.4717
0.7148
0.9627
1.2154
ps_div_ptp=ps./ptp
ps_div_ptp =
2.3390
2.3585
2.3826
2.4068
2.4308
help polyfit
POLYFIT Polynomial curve fitting.
POLYFIT(x,y,n) finds the coefficients of a polynomial p(x) of
degree n that fits the data, p(x(i)) ~= y(i), in a least-squares sense.
[p,S] = POLYFIT(x,y,n) returns the polynomial coefficients p and a
matrix S for use with POLYVAL to produce error estimates on predictions.
If the errors in the data, y, are independent normal with constant
variance, POLYVAL will produce error bounds which contain at least 50%
of the predictions.
See also POLY, POLYVAL, ROOTS.
[p,S]=polyfit(ptp,ps_div_ptp,1)
p =
0.0002 2.3140
S =
-741.6198 -2.0226
0 -0.9535
3.0000 0
0.0029 0
format short e
p
p =
2.3185e-04 2.3140e+00
help polyval
POLYVAL Polynomial evaluation.
If p is a vector of length d+1 whose elements are the coefficients
of a polynomial, then y = POLYVAL(p,x) is the value of the
polynomial evaluated at x.
y = p(1)*x^d + p(2)*x^(d-1) + ... + p(d)*x + p(d+1)
If X is a matrix or vector, the polynomial is evaluated at all
points in X.
[y,delta] = POLYVAL(p,x,S) uses the optional output generated by
POLYFIT to generate error estimates, y +/- delta.
If the errors in the data input to POLYFIT are independent normal
with constant variance, y +/- delta contains at least 50% of the
predictions.
See POLYVALM for evaluation in a matrix sense.
ptp_calc=0:10:500;
[ps_div_ptp_calc,delta]=polyval(p,ptp_calc,S);
plot(ptp_calc,ps_div_ptp_calc)
hold
Current plot held
plot(ptp,ps_div_ptp,'+g')
xlabel('P_TP (torr)')
ylabel('P_s/P_TP')
t=273.16*p(2)
t =
6.3208e+02
delta(1)*273.16
ans =
6.6743e-01
Return to the Homework Home Page.
Return to the Physics 303 Home Page.