how can i tell NonlinearModelFit that a parameter it is supposed to
optimize should be only an Integer?
thank you
Konstantin
>how can i tell NonlinearModelFit that a parameter it is supposed to
>optimize should be only an Integer?
As far as I know, this cannot be done using NonlinearModelFit.
NonlinearModelFit seems to be designed to do non-linear
regression with the usual assumptions. This is an unconstrained
optimization problem. Once you impose a constraint on any
parameter, the problem becomes a constrained optimization
problem. See:
tutorial/UnconstrainedOptimizationOverview
tutorial/ConstrainedOptimizationOverview
=46indFit or NMimimize can be used to find the best fit parameters
with constraints. Look at the second entry in the online
documentation for FindFit for syntax details.
data = {{0, 1}, {1, 0}, {3, 2},
{5, 4}, {6, 4}, {7, 5}};
f[x_] = NonlinearModelFit[data,
Log[a + b x^2], {a, b}, x] // Normal
Log[1.4263297975161129*x^2 + 1.5063204891556876]
f2[x_] = NonlinearModelFit[data,
Log[a + Round[b] x^2], {a, b}, x] // Normal
Log[x^2 + 1.5806558441280811]
f3[x_] = NonlinearModelFit[data,
Log[Round[a] + b x^2], {a, b}, x] // Normal
Log[1.444296658409274*x^2 + 1]
f4[x_] = NonlinearModelFit[data,
Log[Round[a] + Round[b] x^2], {a, b}, x] //
Normal // Quiet
Log[x^2 + 1]
Plot[Evaluate[Tooltip[#[x], #] & /@
{f, f2, f3, f4}], {x, 0, 7},
Epilog -> {Red, AbsolutePointSize[4],
Point[data]},
Frame -> True,
Axes -> False,
PlotRange ->
{{-0.25, 7.25}, {-0.25, 5.25}},
ImageSize -> 600]
Bob Hanlon
---- Ktota <nuk...@gmail.com> wrote:
=============
Hi there,
how can i tell NonlinearModelFit that a parameter it is supposed to
optimize should be only an Integer?
thank you
Konstantin