- #1
s3a
- 818
- 8
Homework Statement
Hello to everyone that's reading this. :)
For this linear least-squares regression problem (typed below and also), I correctly find the value of g (which is what the problem statement wants to have found), but I was curious about the value of ##a_0## (and that's what this entire thread is about).
Problem statement (Alternatively, one can view this PDF: http://docdro.id/GmeGXNr):
"To measure g (the acceleration due to gravity) the following experiment is carried out. A ball is dropped from the top of a 30-m-tall building. As the object is falling down, its speed v is measured at various heights by sensors that are attached to the building. The data measured in the experiment is given in the table.
x (m), v (m/s)
0, 0
5, 9.85
10, 14.32
15, 17.63
20, 19.34
25, 22.41
In terms of the coordinates shown in the figure (positive down), the speed of the ball v as a function of the distance x is given by ##v^2 = 2gx##. Using linear regression, determine the experimental value of g."
Homework Equations
##a_1 = (n Sxy - Sx Sy) / (n Sxx - (Sx)^2)##
##a_0 = (Sxx Sy - Sxy Sx) / (n Sxx - (Sx)^2)##
The Attempt at a Solution
The solution in the PDF:
"The equation v^2 = 2gx can be transformed into linear form by setting Y = v^2. The resulting equation Y = 2gx, is linear in Y and x with m = 2g and b = 0. Therefore, once m is determined, g can be calculated using g = m/s. The calculations are done by executing the following MATLAB program (script file):
Code:
clear all; clc;
x=[0 5 10 15 20 25];
y=[0 9.85 14.32 17.63 19.34 22.41];
Y=y.^2;
X=x;
% Equation 5-13
SX=sum(X);
SY=sum(Y);
SXY=sum(X.*Y);
SXX=sum(X.*X);
% Equation 5-14
n=length(X);
a1=(n*SXY-SX*SY)/(n*SXX-SX^2)
a0=(SXX*SY-SXY*SX)/(n*SXX-SX^2)
m=a1
b=a0
g=m/2
When the program is executed, the following values are displayed in the Command Window:
a1 = 19.7019
a0 = 1.9170
m = 19.7019
b = 1.9170
g = 9.8510
Thus, the measured value of g is 9.8510 m/s^2."
Basically, what's I'd like to know is:
Should the value of ##a_0## be 0 or 1.9170380952380952381? What "wins"? The ##a_0 = (Sxx Sy - Sxy Sx) / (n Sxx - (Sx)^2)## formula or the zero term in v^2 = 2gx + 0?
Any input would be greatly appreciated!