Question: CS101-2020 > HW 13 > Linear data fitting O solutions submitted (max: Unlimited) As a preliminary investigation for the release of a top-secret project, your

CS101-2020 > HW 13 > Linear data fitting O solutions submitted (max: Unlimited) As a preliminary investigation for the release of a top-secret project, your company has asked you to determine the spring constants for a collection of reference springs. Fortunately, the measurements have already been carried out and you have only to interpret them. Recall that spring displacement is governed by Hooke's law, F = -K X where x is the observed displacement and F is the corresponding required force. It is experimentally convenient to use mass (m) to generate the required force (F) using gravity (g). These variables are related by: F = m/1000 *g where mis mass in grams and g is acceleration due to gravity. Thus the spring constant k may be determined from the experimental data as the slope of the line fitting displacement and force data. The data are recorded in the format [mx]; that is, the mass (m) in the first column and the displacement (x) observed in the second. Compose a function 'fit_spring which accepts an array of data in this format and returns the corresponding spring constant k. Use g=9.81. ***NOTE: We assumed that the intercept is 0 but it might not. If you want an accurate answer with an intercept at 0, you will need to use other matlab functions (like fit or nlinfit or others). For our purpose, polyfit is sufficient
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
