Student Support Forum: 'FindMinimum not finding minimum' topicStudent Support Forum > General > "FindMinimum not finding minimum"

 Next Comment > Help | Reply To Topic
 Author Comment/Response Michael 05/21/12 2:48pm Hello. I have only been using Mathematica for about a week now. I am struggling to learn the basics. I have written a few of my first functions and seem to be stuck with the minimization part. I am trying to get a non-linear least squares "fit" to experimental data. I have tried lots of functions that seem like they should work, but never get a good solution. In fact, I generally get a solution that is WORSE than my starting conditions. I will cut-n-paste the current code below and attach the notebook file. I guess I can only attach one file, but I am happy to upload the data in another post. Many thanks for any assistance. Z = (1 + K*f)^n; dfdt = 1 + Mt0*Xbar[t]/Xi - Mt*Xbar'[t]; eqn = Xbar'[t] == D[D[Z, K]*K/Z, f]*dfdt /. f -> t - Mt*Xbar[t] /. Mt -> Mt0 (1 - t/Xi); calNDH[Mt0_, V0_, Vi_, Xi_, DH_?NumericQ, Kd_?NumericQ, n_?NumericQ, injections_, xdata_] := ( d := 1 - (Vi/V0); K := 1/Kd; sol := NDSolve[{eqn, Xbar[0] == 0}, Xbar, {t, 0, Xi*(1 - d^injections)}, AccuracyGoal -> 100]; Lt := xdata; DH*Mt0*(1 - Lt/Xi)*(Xbar'[Lt] /. sol)[[1]] ) data = Import["D:\Hodsdon\Mathematica\hPrl100uME.DAT"]; expLt = data[[2 ;; -2, 3]]/1000 expNDH = data[[2 ;; -2, 6]] ListLinePlot[Partition[Riffle[%%, %], 2]] injections = Length[expLt]; Mt0 = 10 10^-6; V0 = 1.4267 10^-3; Vi = 8 10^-6; Xi = 0.1 10^-3; DH = -16600; Kd = 3 10^-7; n = 0.87; calNDH[Mt0, V0, Vi, Xi, DH, Kd, n, injections, expLt] ListLinePlot[Partition[Riffle[expLt, %], 2]] Total[(expNDH - calNDH[Mt0, V0, Vi, Xi, DH, Kd, n, injections, expLt])^2] FindMinimum[ Total[(expNDH - calNDH[Mt0, V0, Vi, Xi, fDH, fKd, fn, injections, expLt])^2], {{fDH, DH}, {fKd, Kd}, {fn, n}}] Attachment: fit_Nsites_itc.nb, URL: ,

 Subject (listing for 'FindMinimum not finding minimum') Author Date Posted FindMinimum not finding minimum Michael 05/21/12 2:48pm Re: FindMinimum not finding minimum Bill Simpson 05/21/12 10:19pm
 Next Comment > Help | Reply To Topic