[Date Index]
[Thread Index]
[Author Index]
Re: Fittings 2 sets of equations and 2 data sets with nonlinearmodelfit
*To*: mathgroup at smc.vnet.net
*Subject*: [mg121711] Re: Fittings 2 sets of equations and 2 data sets with nonlinearmodelfit
*From*: Ray Koopman <koopman at sfu.ca>
*Date*: Mon, 26 Sep 2011 20:06:24 -0400 (EDT)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*References*: <j5pcf8$8h2$1@smc.vnet.net>
On Sep 26, 1:17 am, JamesE <haywan... at excite.com> wrote:
> Hi,
>
> My names is James Ellison; and I have 2 nonlinear equations of the
> type:
>
> y[1]=x+a*x[1]^2+b*x[1]^3 and y[2]=a*x[2]^3+b*x[2]^5 with the real
> valued parameters a and b for both equations.
>
> I further have 2 data sets
>
> data[1] for y[1] and
> data[2] for y[2]
>
> I can use NonlinearModelFit in order to fit each data[i] set to
> its function y[i] and get good fits. But the parameters a and b
> should be the same.
>
> How can I create a simple code with Mathematica, so that I can do
> a simultaneous fit resulting in the parameters a and b to be the
> same.
>
> I am a Mathematica beginner and would be pleased, if someone could
> answer my question for beginners.
>
> Best regards, James
Although your models are nonlinear in x they are linear in the
unknown parameters, and it is the latter that matters here.
Write your model as w = a*u + b*v, where {u, v, w} =
{x^2, x^3, y-x} for data[1] and {x^3, x^5, y} for data[2].
If data[1] and data[2] contain {x,y} pairs then
Join[{#1^2, #1^3, #2-#1}& @@@ data[1],
{#1^3, #1^5, #2 }& @@@ data[2]}]
will give you a data matrix that can be input to LinearModelFit.
Be sure to specify IncludeConstantBasis->False.
Prev by Date:
**Constrain locator**
Next by Date:
**Re: Fittings 2 sets of equations and 2 data sets with nonlinearmodelfit**
Previous by thread:
**Fittings 2 sets of equations and 2 data sets with nonlinearmodelfit**
Next by thread:
**Re: Fittings 2 sets of equations and 2 data sets with nonlinearmodelfit**
| |