Suitability of fit.

4 views (last 30 days)
Cheng-Han Yang
Cheng-Han Yang on 23 Apr 2019
Edited: Cheng-Han Yang on 23 Apr 2019
So this is my homework, stuck on this part for 2 hours now. I did what I already know to find the best fit and these 3 lines which always work whenever I need to show the suitability of a fit. But the outcome is an impossible value. (-5.something) Did I do something wrong?
m=a\b;
fit=m*a;
R2=1-(sum((b-fit).^2)/sum((b-mean(b)).^2));
And the other quesiton about the starting distance and acceleration as shown below, I have no idea why I am stuck on this one for so long, but I just couldn't find it sensible to me judging from the data stand point.
I post the whole question just in case you need all of the information to help me. Thank you in advance.
A ball is released from a height and allowed to fall under gravity. The distance S, is measured as a function of time, t.
The equation for motion is given by
S=So+ut+0.5at^2
Where So is the initial distance, u the initial velocity and a the acceleration.
Prints out the initial starting distance and acceleration of the system and show the suitability of this fit.
Data for the question
time,distance
(S),(m)
0.100,10.51
0.120,9.16
0.140,9.90
0.160,9.01
0.180,10.64
0.200,9.59
0.220,9.79
0.240,9.69
0.260,9.74
0.280,9.69
0.300,9.92
0.320,9.44
0.340,9.19
0.360,10.26
0.380,9.96
0.400,9.04
0.420,8.42
0.440,9.48
0.460,8.42
0.480,8.85
0.500,8.93
0.520,8.62
0.540,9.15
0.560,8.59
0.580,8.96
0.600,8.40
0.620,8.45
0.640,7.93
0.660,7.64
0.680,7.85
0.700,8.43
0.720,7.96
0.740,7.16
0.760,7.05
0.780,7.80
0.800,6.35
0.820,7.01
0.840,6.79
0.860,6.33
0.880,6.37
0.900,6.42
0.920,6.55
0.940,5.52
0.960,5.51
0.980,4.98
1.000,5.64
1.020,5.43
1.040,5.24
1.060,4.63
1.080,4.60
1.100,4.18
1.120,3.96
1.140,4.10
1.160,3.58
1.180,3.23
1.200,3.00

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!