Let's say, that we have a list of parameters, that we want to use in manipulate, like so:
parameters={{a,0,5},{b,-1,5}};
Of corse you could manually copy and paste that into Manipulate[]
, but in the problem I'm actually solving, you can't do that.
Below is a very simple example and 2 versions of the code, that don't work:
VERSION 1
plot1=ListPlot@Table[{x,2x+3}+RandomReal[.4,2],{x,-5,5}];
parameters={{a,0,5},{b,-1,5}};
Manipulate@@Join[
{Show[plot1,Plot[a x + b, {x,-5,5}]]},
parameters
]
VERSION 2
plot1=ListPlot@Table[{x,2x+3}+RandomReal[.4,2],{x,-5,5}];
parameters={{a,0,5},{b,-1,5}};
Manipulate[
Show[plot1,Plot[a x + b, {x,-5,5}]],
Splice@parameters
]
And I tied a few more things, but none of them work. How to do it?
Fit
,LinearModelFit
, orNonlinearModelFit
. $\endgroup$NonlinearModelFit
. But also for fitingNonlinearModelFit
can be very unstble (finding the wrong local RMS minimums). In some cases, like even if you set the initial values quite close, the fit can be completely wrong. In that case doing it manually is probably the best you can (easyly) do. $\endgroup$Table
theNonlinearModelFit
for many different initial values of parameters in some ranges, and chose the best one, but it might still be not that stable, and with a lot of parameters, you could only take a few values for each parameter $\endgroup$NonlinearModelFit
you should post a question showing what you have tried and others might be able to suggest how to overcome the problem. $\endgroup$