1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Linear Least-Squares Regression: a_0 = ?

  1. Aug 1, 2017 #1


    User Avatar

    1. The problem statement, all variables and given/known data
    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."

    2. Relevant equations
    ##a_1 = (n Sxy - Sx Sy) / (n Sxx - (Sx)^2)##
    ##a_0 = (Sxx Sy - Sxy Sx) / (n Sxx - (Sx)^2)##

    3. 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 (Text):

    clear all; clc;
    x=[0 5 10 15 20 25];
    y=[0 9.85 14.32 17.63 19.34 22.41];
    % Equation 5-13
    % Equation 5-14
    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!
  2. jcsd
  3. Aug 1, 2017 #2


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    We know from what a0 represents (the velocity at time 0), that it must be 0. I can't immediately think of a nice way to force that, but I tried adding more (0,0) points into the regression. That should do more to force the regression to a0 = 0 without invalidating the other data points. By forcing the regression line more toward the (0,0) point, it should also get a steeper slope to go through the other data points. With 10 such (0,0) points added, the regression gave a0 = 0.3073 and m = 19.7897. With 20 such (0,0) points added, the regression gave a0 = 0.1598 and m = 19.7978.

    Forcing a0=0 is bringing the value of g farther from the standard value of 9.807. That suggests the possibility that the ball was actually thrown down with some velocity like your original a0 = 1.9170, and that the original (0,0) data point is wrong. In that case, your original results would be more legitimate.

    Gravity does change from place to place, so it is hard to say what is right. I don't know how much it might change.
    Last edited: Aug 1, 2017
  4. Aug 4, 2017 #3


    User Avatar

    Okay, so it now makes sense to me why it seems that the question is not asking for the line as a whole; it's just asking for linear regression to be used (in order to indirectly find g). If we change the slope (such as by adding a lot of (0,0) points), we're increasing the unreliability/overall error of the line, and it seems to me that the reliability of the line, in general, is more important than forcing a_0 to be equal to 0 (especially since it is known with 100% accuracy that the square of the velocity is 0, when the distance travelled is 0, and since we want a_1 to be as accurate as possible so that we get a value for g that's as accurate as possible, and a_1 is most accurate when a_0 is ≈1.92, instead of 0).

    Please do let me know if anything I just said is wrong, but I'm optismitic about it all being correct.

    Thanks for your input! :)
  5. Aug 4, 2017 #4


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    In an ideal world, a0 = 0. Since the data doesn't exactly support that, you have to use your best judgment.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted