Message Boards Message Boards

Simultaneous fitting to multiple data sets with multiple variables and para

Posted 11 years ago

I am trying to fit two data sets to a function model described below which share a few common parameters. Say I have two functions with some common parameter(s)

f[x,y]:= aExp[-x]Sin[b*y] + c g[x,y]:= dExp[-x]Sin[b*y] + c

I generated two model data sets using a functional form similar to the ones above and tried to fit the data using NonlinearModelFit. But NonlinearModelFit fails to converge within the prescribed iterations and confidence interval.

I tried checking the threads (http://mathematica.stackexchange.com/questions/15905/combined-fitting-via-nonlinearmodelfit or http://forums.wolfram.com/mathgroup/archive/2011/Sep/msg00555.html or http://community.wolfram.com/groups/-/m/t/135933) on similar discussions but could not solve my problem. Any suggestions would be welcome.

Thanks in advance.

Arijit.

POSTED BY: Arijit Sharma
2 Replies
Posted 11 years ago

Arijit, do you have any sample data and code?

POSTED BY: Priyan Fernando
Posted 11 years ago

Hi Priyan, Yes there is..In fact the actual problem was difficult for me to handle. So I posted a simpler version of the problem I was encountering. I post the two data sets below:

data2a={{8.10^-8, 9.56}, {1.0810^-6, 9.8675}, {2.0810^-6, 9.5225}, {3.0810^-6, 9.2775}, {4.0810^-6, 9.475}, {5.0810^-6, 8.9625}, {6.0810^-6, 9.28}, {7.0810^-6, 8.54}, {8.0810^-6, 8.235}, {9.0810^-6, 7.7225}, {0.00001008, 7.55}, {0.00001108, 7.66}, {0.00001208, 6.9075}, {0.00001308, 6.085}, {0.00001408, 5.65}, {0.00001508, 4.7625}, {0.00001608, 4.7}, {0.00001708, 4.65}, {0.00001808, 4.03}, {0.00001908, 3.48}, {0.00002008, 3.0875}, {0.00002108, 2.65}, {0.00002208, 2.275}, {0.00002308, 1.6025}, {0.00002408, 1.8825}, {0.00002508, 1.2175}, {0.00002608, 1.18}, {0.00002708, 0.975}, {0.00002808, 0.7475}, {0.00002908, 0.6175}, {0.00003008, 0.5075}, {0.00003108, 0.39}, {0.00003208, 0.775}, {0.00003308, 0.4575}, {0.00003408, 0.765}, {0.00003508, 0.9775}, {0.00003608, 1.4125}, {0.00003708, 1.825}, {0.00003808, 1.9475}, {0.00003908, 2.2525}, {0.00004008, 2.375}, {0.00004108, 2.8625}, {0.00004208, 3.515}, {0.00004308, 3.8775}, {0.00004408, 4.5625}, {0.00004508, 4.94}, {0.00004608, 6.0175}, {0.00004708, 5.845}, {0.00004808, 6.695}, {0.00004908, 6.89}, {0.00005008, 7.01}, {0.00005108, 7.3675}, {0.00005208, 7.78}, {0.00005308, 7.87}, {0.00005408, 8.0925}, {0.00005508, 8.7325}, {0.00005608, 8.5675}, {0.00005708, 8.6525}, {0.00005808, 8.62}, {0.00005908, 8.995}, {0.00006008, 8.905}, {0.00006108, 8.7975}, {0.00006208, 8.4775}, {0.00006308, 8.6225}, {0.00006408, 8.7725}, {0.00006508, 8.2575}, {0.00006608, 7.91}, {0.00006708, 7.58}, {0.00006808, 7.05}, {0.00006908, 6.7925}, {0.00007008, 6.635}, {0.00007108, 6.3625}, {0.00007208, 5.755}, {0.00007308, 5.455}, {0.00007408, 4.8875}, {0.00007508, 4.33}, {0.00007608, 3.5775}, {0.00007708, 4.03}, {0.00007808, 3.115}, {0.00007908, 2.6275}, {0.00008008, 2.4025}, {0.00008108, 2.92}, {0.00008208, 2.49}, {0.00008308, 2}, {0.00008408, 1.7725}, {0.00008508, 1.625}, {0.00008608, 1.655}, {0.00008708, 1.7125}, {0.00008808, 1.6075}, {0.00008908, 1.7475}, {0.00009008, 1.4125}, {0.00009108, 1.6525}, {0.00009208, 1.565}, {0.00009308, 1.6875}, {0.00009408, 2.13}, {0.00009508, 2.0475}, {0.00009608, 2.445}, {0.00009708, 2.9875}, {0.00009808, 3.035}, {0.00009908, 3.065}, {0.00010008, 3.48}, {0.00010108, 3.7725}, {0.00010208, 4.2325}, {0.00010308, 4.62}, {0.00010408, 4.805}, {0.00010508, 5.745}, {0.00010608, 5.9}, {0.00010708, 6.3675}, {0.00010808, 6.4725}, {0.00010908, 6.4275}, {0.00011008, 7.0125}, {0.00011108, 7.9575}, {0.00011208, 7.155}, {0.00011308, 7.49}, {0.00011408, 7.86}, {0.00011508, 7.9}, {0.00011608, 8.1775}, {0.00011708, 8.065}, {0.00011808, 8.2275}, {0.00011908, 8.4825}, {0.00012008, 8.3275}, {0.00012108, 8.5}, {0.00012208, 7.91}, {0.00012308, 7.2325}, {0.00012408, 7.83}, {0.00012508, 7.1625}, {0.00012608, 6.82}, {0.00012708, 7.2325}, {0.00012808, 6.415}, {0.00012908, 6.03}, {0.00013008, 5.8725}, {0.00013108, 5.78}, {0.00013208, 5.16}, {0.00013308, 5.1725}, {0.00013408, 5.0575}, {0.00013508, 4.4825}, {0.00013608, 3.8575}, {0.00013708, 4.3225}, {0.00013808, 3.925}, {0.00013908, 3.615}, {0.00014008, 3.315}, {0.00014108, 2.915}, {0.00014208, 2.5075}, {0.00014308, 2.4275}, {0.00014408, 2.06}, {0.00014508, 2.3625}, {0.00014608, 1.9525}, {0.00014708, 2.2325}, {0.00014808, 2.2575}, {0.00014908, 1.8575}, {0.00015008, 2.0475}, {0.00015108, 2.7325}, {0.00015208, 2.375}, {0.00015308, 2.59}, {0.00015408, 2.785}, {0.00015508, 2.9675}, {0.00015608, 3.515}, {0.00015708, 3.715}, {0.00015808, 3.66}, {0.00015908, 4.1925}, {0.00016008, 3.8875}, {0.00016108, 4.0925}, {0.00016208, 4.6275}, {0.00016308, 5.2725}, {0.00016408, 5.2275}, {0.00016508, 5.1775}, {0.00016608, 5.27}, {0.00016708, 5.59}, {0.00016808, 6.46}, {0.00016908, 6.72}, {0.00017008, 7.4625}, {0.00017108, 7.225}, {0.00017208, 7.4325}, {0.00017308, 6.78}, {0.00017408, 7.18}, {0.00017508, 7.5675}, {0.00017608, 7.8125}, {0.00017708, 7.74}, {0.00017808, 7.0225}, {0.00017908, 8.0475}, {0.00018008, 7.705}, {0.00018108, 7.555}, {0.00018208, 7.2525}, {0.00018308, 6.8675}, {0.00018408, 6.9925}, {0.00018508, 6.8375}, {0.00018608, 6.5275}, {0.00018708, 6.2025}, {0.00018808, 5.8425}, {0.00018908, 5.585}, {0.00019008, 5.725}, {0.00019108, 5.1875}, {0.00019208, 5.3}, {0.00019308, 4.4225}, {0.00019408, 4.655}, {0.00019508, 4.0325}, {0.00019608, 4.0225}, {0.00019708, 3.4675}, {0.00019808, 4.045}, {0.00019908, 3.1425}, {0.00020008, 3.245}, {0.00020108, 3.395}, {0.00020208, 2.965}, {0.00020308, 2.6425}, {0.00020408, 2.815}, {0.00020508, 3.0525}, {0.00020608, 2.6775}, {0.00020708, 2.8825}, {0.00020808, 3.1425}, {0.00020908, 3.155}, {0.00021008, 3.275}, {0.00021108, 3.445}, {0.00021208, 3.2725}, {0.00021308, 3.995}, {0.00021408, 3.655}, {0.00021508, 4.6575}, {0.00021608, 4.8375}, {0.00021708, 4.86}, {0.00021808, 4.445}, {0.00021908, 4.33}, {0.00022008, 3.8275}, {0.00022108, 4.365}, {0.00022208, 4.64}, {0.00022308, 4.5825}, {0.00022408, 4.75}, {0.00022508, 5.5}, {0.00022608, 5.7175}, {0.00022708, 6.435}, {0.00022808, 6.23}, {0.00022908, 6.865}, {0.00023008, 6.5075}, {0.00023108, 6.9775}, {0.00023208, 6.765}, {0.00023308, 6.725}, {0.00023408, 7.0325}, {0.00023508, 6.6475}, {0.00023608, 6.2625}, {0.00023708, 6.205}, {0.00023808, 6.2075}, {0.00023908, 6.1275}, {0.00024008, 5.575}, {0.00024108, 5.695}, {0.00024208, 6.785}, {0.00024308, 6.0725}, {0.00024408, 6.6775}, {0.00024508, 5.7825}, {0.00024608, 5.8925}, {0.00024708, 4.07}, {0.00024808, 3.8625}, {0.00024908, 3.6275}, {0.00025008, 4.3}, {0.00025108, 3.665}, {0.00025208, 3.78}};

data2b={{8.10^-8, 7.9525}, {1.0810^-6, 8.22}, {2.0810^-6, 7.875}, {3.0810^-6, 7.605}, {4.0810^-6, 7.335}, {5.0810^-6, 6.835}, {6.0810^-6, 6.3425}, {7.0810^-6, 5.4625}, {8.0810^-6, 4.195}, {9.0810^-6, 3.8275}, {0.00001008, 2.7175}, {0.00001108, 1.8625}, {0.00001208, 1.7075}, {0.00001308, 1.09}, {0.00001408, 0.525}, {0.00001508, 0.375}, {0.00001608, 0.3525}, {0.00001708, 0.5775}, {0.00001808, 0.7775}, {0.00001908, 1.0825}, {0.00002008, 1.66}, {0.00002108, 2.4525}, {0.00002208, 2.565}, {0.00002308, 3.5425}, {0.00002408, 4.5925}, {0.00002508, 4.89}, {0.00002608, 5.7225}, {0.00002708, 6.6975}, {0.00002808, 6.775}, {0.00002908, 7.2125}, {0.00003008, 7.39}, {0.00003108, 8.1675}, {0.00003208, 7.71}, {0.00003308, 7.765}, {0.00003408, 7.1675}, {0.00003508, 6.96}, {0.00003608, 6.57}, {0.00003708, 5.805}, {0.00003808, 4.92}, {0.00003908, 4.535}, {0.00004008, 3.8625}, {0.00004108, 3.3425}, {0.00004208, 1.9825}, {0.00004308, 1.4825}, {0.00004408, 1.3925}, {0.00004508, 0.94}, {0.00004608, 0.69}, {0.00004708, 0.68}, {0.00004808, 0.725}, {0.00004908, 1.0425}, {0.00005008, 1.1225}, {0.00005108, 1.5425}, {0.00005208, 2.4125}, {0.00005308, 2.76}, {0.00005408, 4.1325}, {0.00005508, 4.18}, {0.00005608, 5.22}, {0.00005708, 5.9575}, {0.00005808, 6.1725}, {0.00005908, 6.6675}, {0.00006008, 6.9075}, {0.00006108, 7.015}, {0.00006208, 7.6125}, {0.00006308, 7.26}, {0.00006408, 6.87}, {0.00006508, 7.1275}, {0.00006608, 6.9375}, {0.00006708, 6.11}, {0.00006808, 5.46}, {0.00006908, 4.26}, {0.00007008, 4.0625}, {0.00007108, 3.545}, {0.00007208, 3.1575}, {0.00007308, 2.3625}, {0.00007408, 1.665}, {0.00007508, 1.53}, {0.00007608, 1.195}, {0.00007708, 1.1325}, {0.00007808, 1.0975}, {0.00007908, 1.22}, {0.00008008, 1.28}, {0.00008108, 1.4925}, {0.00008208, 2.43}, {0.00008308, 2.415}, {0.00008408, 3.0875}, {0.00008508, 3.7575}, {0.00008608, 4.2325}, {0.00008708, 5.0875}, {0.00008808, 5.7975}, {0.00008908, 5.7275}, {0.00009008, 6.38}, {0.00009108, 6.98}, {0.00009208, 6.8775}, {0.00009308, 6.6775}, {0.00009408, 6.7225}, {0.00009508, 6.7725}, {0.00009608, 6.5775}, {0.00009708, 5.8525}, {0.00009808, 5.55}, {0.00009908, 5.215}, {0.00010008, 4.81}, {0.00010108, 3.9125}, {0.00010208, 3.6525}, {0.00010308, 2.955}, {0.00010408, 2.9575}, {0.00010508, 1.8325}, {0.00010608, 1.68}, {0.00010708, 1.55}, {0.00010808, 1.575}, {0.00010908, 1.7625}, {0.00011008, 1.63}, {0.00011108, 1.7075}, {0.00011208, 2.25}, {0.00011308, 2.4425}, {0.00011408, 3.135}, {0.00011508, 3.2725}, {0.00011608, 4.2325}, {0.00011708, 4.3775}, {0.00011808, 4.4025}, {0.00011908, 5.59}, {0.00012008, 5.78}, {0.00012108, 6.0325}, {0.00012208, 6.2575}, {0.00012308, 6.54}, {0.00012408, 6.545}, {0.00012508, 6.28}, {0.00012608, 6.2225}, {0.00012708, 6.37}, {0.00012808, 5.875}, {0.00012908, 5.225}, {0.00013008, 4.8025}, {0.00013108, 4.3425}, {0.00013208, 3.7825}, {0.00013308, 3.055}, {0.00013408, 2.71}, {0.00013508, 2.575}, {0.00013608, 2.3925}, {0.00013708, 2.1775}, {0.00013808, 2.4}, {0.00013908, 1.9525}, {0.00014008, 2.05}, {0.00014108, 2.135}, {0.00014208, 3.1175}, {0.00014308, 3.2675}, {0.00014408, 3.355}, {0.00014508, 3.9775}, {0.00014608, 3.81}};

My functional form is f[t, n, offset, Pitime, a, t[Phi], [Tau]_] := offset + a*1/ 2 (1 + Exp[-t/[Tau]]*(1/(n + 1)) (( Cos[2[CapitalOmega]R[Pitime](t + t[Phi])](1 - x[n]Cos[ 2[CapitalOmega]R[Pitime](t + t[Phi])*[Eta]LD^2]) + x[n]Sin[2[CapitalOmega]R[Pitime](t + t[Phi])] Sin[2[CapitalOmega]R[Pitime](t + t[Phi])*[Eta]LD^2])/( 1 + x[n]^2 - 2x[n]Cos[ 2[CapitalOmega]R[Pitime](t + t[Phi])*[Eta]LD^2])));

where [Eta]LD = 0.02786;

x[n_] := ( n/(n + 1));

[CapitalOmega]R[Pitime_] := [Pi]/(2*Pitime);

Here offset, Pitime, a, t[Phi] are the free parameters for both data sets. n and [Tau] are the fixed parameters for both data sets. t is the time over which the data has been recorded.

Hope this gives you the complete picture of the problem I am trying to address. If there is any other information you may need, kindly inform me.

Cheers, Arijit.

POSTED BY: Arijit Sharma
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract