Question C.3.3: Use MATLAB to fit a straight line to the beam force-deflecti...

Use MATLAB to fit a straight line to the beam force-deflection data given in Example C.3.2, but constrain the line to pass through the origin.

The 'Blue Check Mark' means that either the MATLAB code/script/answer provided in the answer section has been tested by our team of experts; or the answer in general has be fact checked.

Learn more on how do we answer questions.

We can apply (C.2.3), noting here that the measured variable is the deflection x and the independent variable is the force f . Thus, (C.2.3) becomes

m \sum_{i=1}^n f_i^2=\sum_{i=1}^n f_i x_i              (1)

The MATLAB programto solve this equation for m and k is

% Enter the data
x = [0, 0.15, 0.23, 0.35, 0.37, 0.5, 0.57, 0.68, 0.77];
f = (0:100:800);
% Compute m from (1).
m = sum(f.*x)/sum(f.ˆ2);
% Compute the stiffness.
k = 1/m
% Compute J, S, and r squared.
J = sum((m*f-x).ˆ2)
S = sum((x-mean(x)).ˆ2)
r2 = 1 - J/S

The answer is k = 1021 lb/in. The corresponding line is shown in Figure C.3.3. The qualityof- fit values are J = 0.0081, S = 0.5090, and r² = 0.9840, which indicates a good fit.

Fig C.3.3

Related Answered Questions

Question: C.2.3

Verified Answer:

The least-squares criterion is J=\sum_{i=1}...
Question: C.2.2

Verified Answer:

Subtracting 10 from all the x values and 11 from a...
Question: C.2.1

Verified Answer:

These data do not lie close to a straight line whe...