Question: 2. It is known that the force exerted by a spring is proportional to the distance it is stretched (that is, the displacement from its


2. It is known that the force exerted by a spring is proportional to the distance it is stretched (that is, the displacement from its equilibrium position. In equation form: kx where f is the force, k is the spring constant, and x is the distance (or displacement). You have a spring for which you measure Distance (cm) 2.0 4.0 7.0 11.0 17.0 Force (N) 2.0 3.5 4.5 8.0 9.9 Write a MATLAB script (Hw06p2.m) that performs the following: a. Find the "least-square fit" line to the data (hint: use polyfit). b. Compute the r2 value of the fit. c. Plot the data (as symbols) and the fit (as a line) 2. It is known that the force exerted by a spring is proportional to the distance it is stretched (that is, the displacement from its equilibrium position. In equation form: kx where f is the force, k is the spring constant, and x is the distance (or displacement). You have a spring for which you measure Distance (cm) 2.0 4.0 7.0 11.0 17.0 Force (N) 2.0 3.5 4.5 8.0 9.9 Write a MATLAB script (Hw06p2.m) that performs the following: a. Find the "least-square fit" line to the data (hint: use polyfit). b. Compute the r2 value of the fit. c. Plot the data (as symbols) and the fit (as a line)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
