enter image description here

I am trying to fit some experimental data to a Van der Pol oscillator model, solving the differential equation and using FindFit (like in the examples given in the Wolfram Documentation) like this:

       f_?NumberQ]:=(model[\[Mu],r,a,b,c,d,f]=First[x/. NDSolve[{x''[t]-\[Mu]*(r-b*x[t]^2)*x'[t]+d*x[t]==f, x[0]==a, x'[0]==c},x,{t,0,15}]])



where gp is simply the ListLinePlot of my data. I struggled a lot to find by hand some values for all the parameters in order to have already good overlap between the model and the data, because I know that the method above is quite sensitive to that. Anyway, when I input the parameters and run it, what eventually happens is that the method seems to work, optimising slightly the parameters and making the plot, BUT I always get the message:

FindFit: The step size in the search has become less than the tolerance prescribed by the PrecisionGoal option, but the gradient is larger than the tolerance specified by the AccuracyGoal option. There is a possibility that the method has stalled at a point that is not a local minimum.

I never understood what this means...Does it actually mean the fit didn't really work? How do I get rid of it and make sure the method I'm using is working??

Data sample here

Thanks, GIacomo

  • 1
    $\begingroup$ a sample data would be highly appreciated. $\endgroup$
    – Rupesh
    Mar 18, 2020 at 12:57
  • $\begingroup$ Ok, do you know how I can upload a .dat file here? In any case, I receive the same "error", if I generate points using the same model, and try to fit them afterwards (even if the fit looks great in this case obviously) $\endgroup$
    – Giacomo F
    Mar 18, 2020 at 14:18
  • $\begingroup$ share some onedrive or google drive link $\endgroup$
    – Rupesh
    Mar 18, 2020 at 14:36
  • $\begingroup$ Done! It's at the bottom of my question. Cheers $\endgroup$
    – Giacomo F
    Mar 18, 2020 at 14:46
  • $\begingroup$ Show[ListPlot[data], gpp] certainly suggests that it might have worked. Adding in that figure would be helpful. $\endgroup$
    – JimB
    Mar 18, 2020 at 15:15

1 Answer 1


I don't think the model is flexible enough to fit the data. Playing with the parameters does not seem to produce a better fit. Below I use the parameter estimates for the initial values.

Manipulate[gpp = Plot[model[μ, r, a, b, c, d, f][x], {x, 0, 5}, PlotStyle -> Red];
 Show[ListPlot[data], gpp],
 {{μ, 149.836}, 140, 160, Appearance -> "Labeled"},
 {{r, 0.235986}, 0.2, 0.3, Appearance -> "Labeled"},
 {{a, -0.0412192}, -0.03, -0.05, Appearance -> "Labeled"},
 {{b, 763.669}, 700, 800, Appearance -> "Labeled"},
 {{c, 0.654687}, 0.6, 0.7, Appearance -> "Labeled"},
 {{d, 49.8976}, 40, 60, Appearance -> "Labeled"},
 {{f, -0.52549}, -0.4, -0.6, Appearance -> "Labeled"}]

Manipulation of parameters

  • $\begingroup$ Yeah, I agree. That's what I've been doing by hand basically (The Manipulate tool is pretty useful though, this is the first time I use it, Thanks!). Well, good to know at least that I wasn't just doing something completely stupid. Thanks again! $\endgroup$
    – Giacomo F
    Mar 18, 2020 at 16:05

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.