Nonlinear fitting question
- To: mathgroup at smc.vnet.net
- Subject: [mg111577] Nonlinear fitting question
- From: eric g <eric.phys at gmail.com>
- Date: Fri, 6 Aug 2010 06:56:07 -0400 (EDT)
Hello Group, In the example below I want to do a fitting "exploiting" the correlation between y1 and y2 rather than separate them like I did. Like a 2D fitting thing. Also, in NonlinearModelFit, I dont like treating 1/(1+b) like another parameter. how to do it? best regards, Eric (* my model *) b = 1; k = 1/2; y1[t_] = (b + Exp[-k*t])/(1 + b); y2[t_] = (1 - Exp[-k*t])/(1 + b); (* my measurements *) dat1 = Table[{t, y1[t] + RandomReal[{-1, 1}]/20}, {t, 0, 10, .1}]; dat2 = Table[{t, y2[t] + RandomReal[{-1, 1}]/20}, {t, 0, 10, .1}]; Plot[{y1[t], y2[t]}, {t, 0, 10}, Epilog -> {{Red, Point[dat1]}, {Blue, Point[dat2]}}, PlotStyle -> {Red, Blue}] (*FITTING*) (* results with dat1: *) Clear[b, k]; Normal[NonlinearModelFit[dat1, (b + Exp[-k*t])/(1 + b), {b, k}, t]] 0.504916 (0.980528 + E^(-0.492309 t)) (* results with dat2: *) Clear[b, k]; Normal[NonlinearModelFit[dat2, (1 - Exp[-k*t])/(1 + b), {b, k}, t]] 0.494348 (1 - E^(-0.524777 t))