0
$\begingroup$

I want to find fit to this data and the equation:

enter image description here

Clear["Global`*"];
data = {{1, 1.2926876`}, {2, 2.4296988`}, {3, 3.3392012`}, {4, 
    4.1653912`}, {5, 4.9024912`}, {6, 5.5450292`}, {7, 6.108284`}, {8,
     6.6103844`}, {9, 7.0690112`}, {10, 7.4914848`}, {11, 
    7.8963848`}, {12, 8.2873168`}, {13, 8.663396`}, {14, 
    9.0243192`}, {15, 9.3678864`}, {16, 9.6954168`}, {17, 
    10.0114072`}, {18, 10.316488`}, {19, 10.6176864`}, {20, 
    10.9121928`}, {21, 11.1988224`}, {22, 11.4784872`}, {23, 
    11.750596`}, {24, 12.015308`}, {25, 12.2748`}, {26, 
    12.5285192`}, {27, 12.7795192`}, {28, 13.0259888`}, {29, 
    13.2677224`}, {30, 13.5053088`}, {31, 13.738288`}, {32, 
    13.966112`}, {33, 14.1911264`}, {34, 14.4120976`}, {35, 
    14.6317952`}, {36, 14.8479104`}, {37, 15.060792`}, {38, 
    15.271192`}, {39, 15.4784384`}, {40, 15.6821936`}, {41, 
    15.8837296`}, {42, 16.0824256`}, {43, 16.2807056`}, {44, 
    16.47644`}, {45, 16.6694944`}, {46, 16.8607952`}, {47, 
    17.04932`}, {48, 17.23492`}, {49, 17.4187984`}, {50, 
    17.6000976`}, {51, 17.7814976`}, {52, 17.961104`}, {53, 
    18.1384144`}, {54, 18.3144992`}, {55, 18.4882992`}, {56, 
    18.6596016`}, {57, 18.829616`}, {58, 18.9977008`}, {59, 
    19.1663024`}, {60, 19.3337312`}, {61, 19.4992272`}, {62, 
    19.6638032`}, {63, 19.826504`}, {64, 19.9871216`}, {65, 
    20.1467344`}, {66, 20.304648`}, {67, 20.4630064`}, {68, 
    20.6204512`}, {69, 20.7763472`}, {70, 20.9313552`}, {71, 
    21.0848432`}, {72, 21.2365424`}, {73, 21.3874256`}, {74, 
    21.5367104`}, {75, 21.6865104`}};
n0 = 8;
FindFit[data, (-\[Omega]0 + Sqrt[4 n \[Pi] \[Alpha] + n0 \[Omega]0^2]/
  Sqrt[n0])/\[Alpha], {\[Omega]0, \[Alpha]}, n]

enter image description here

I have no idea, why it does not work. I get those errors and the output is also wrong. How to fix it?

$\endgroup$
3
  • 1
    $\begingroup$ You don't have usable initial estimates for your parameters? $\endgroup$ Commented Dec 22, 2021 at 19:22
  • $\begingroup$ How can I set initial estimates for the parameters? $\endgroup$
    – Gal Zajc
    Commented Dec 22, 2021 at 19:24
  • 1
    $\begingroup$ You should look at the "Details and Options" section of the docs for FindFit[] for more details, but in brief, you do something like FindFit[data, model[x], {{param1, param1est}, ...}, x]. $\endgroup$ Commented Dec 22, 2021 at 19:48

1 Answer 1

4
$\begingroup$

Ensure that w0 and alpha are positive by e.g.:

sol=FindFit[data, {(-ω0 + Sqrt[4 n π α + n0 ω0^2]/ Sqrt[n0])/α, ω0 > 0, α> 0}, {ω0, α}, n]

To check the solution we may plot it:

Plot[f[n], {n, 1, 75}, Epilog -> Point[data]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.