0
$\begingroup$

I need some help again, with this simple exercise:

Use the data to determine g, but this time use the functional form T = 2 pi Sqrt[L/g] for the period T of a pendulum of length . Do this both using a linear fit of T^2 versus L, and then using a nonlinear fit to the original functional form. In both cases, make a plot of the data with the fit superimposed.

the first column is length and the second column is time

data2 = {{1.778, 2.6750}, {1.4986, 2.486}, {1.1938, 2.181}, {0.8382,1.829}, {0.6604, 1.613}, {0.4826, 1.3780}, {0.2032, 0.887}}

I do this por the firts part: "linear fit of T^2 versus L"

T[x_] := 2 \[Pi] Sqrt[L[x]/g[x]]

fitg1 = Fit[data2, {1, x, x^2}, x]

grafi2 = ListPlot[data2, PlotRange -> All, PlotStyle -> Red]

Show[grafi2, Plot[fitg1, {x, 0.2, 2.4}]]

And second part dont work for me :( I dont know why : "and then using a nonlinear fit to the original functional form"

fitgval = FindFit[data2, T[x], {L, g}, x]

fitg2 = T[x] /. fitgval

I think something really I'm wrong interpreting...

$\endgroup$
  • $\begingroup$ How about using T[L_] := 2 \[Pi] Sqrt[L/g]? $\endgroup$ – JimB May 12 at 17:49
  • $\begingroup$ still no working with FindFit, it is very frustrating $\endgroup$ – Chris Schwenke May 12 at 18:17
  • $\begingroup$ Use @JimB's suggestion and change fitgval to fitgval = FindFit[data2, 2 Pi Sqrt[L/g], {g}, L]. $\endgroup$ – Tim Laska May 12 at 20:16
  • $\begingroup$ thanks @TimLaska and JimB that working $\endgroup$ – Chris Schwenke May 12 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.