I am trying to fit a part of a dataset to the function $$ae^{-b\sqrt{x-c}}$$. My friend was using GNUPlot to this and got reasonably good results. However when I try to this with Mathematica :

NonlinearModelFit[Tmean, a*Exp[-b*Sqrt[x - c]], {{a, 45}, {b, 2}, {c, 1.8}}, x]).
-188.006 E^{1.17551\sqrt{-<<18>> + x}}

Data= {{2.76134, 6.134}, {2.7552, 6.081}, {2.7491, 6.224}, {2.74301, 6.288}, {2.73696, 6.629}, {2.73093, 6.486}, {2.72493, 6.719}, {2.71895, 6.989}, {2.713, 7.076}, {2.70708, 7.293}, {2.70118, 7.152}, {2.69531, 7.37}, {2.68946, 7.626}, {2.68364, 7.59}, {2.67784, 7.74}, {2.67207, 7.723}, {2.66633, 7.606}, {2.66061, 7.855}, {2.65491, 7.668}, {2.64923, 8.03}, {2.64359, 8.16}, {2.63796, 7.932}, {2.63236, 8.174}, {2.62678, 8.335}, {2.62123, 8.171}, {2.6157, 8.292}, {2.61019, 8.247}, {2.60471, 8.363}, {2.59925, 8.541}, {2.59381, 8.357}, {2.5884, 8.347}, {2.583, 8.404}, {2.57763, 8.414}, {2.57229, 8.363}, {2.56696, 8.509}, {2.56166, 8.556}, {2.55638, 8.297}, {2.55112, 8.562}, {2.54588, 8.335}, {2.54066, 8.359}, {2.53546, 8.581}, {2.53029, 8.311}, {2.52514, 8.308}, {2.52, 8.276}, {2.51489, 8.337}, {2.5098, 8.075}, {2.50473, 8.098}, {2.49968, 8.119}, {2.49465, 7.891}, {2.48964, 7.682}, {2.48465, 7.519}, {2.47968, 7.593}, {2.47473, 7.482}, {2.4698, 7.567}, {2.46489, 7.053}, {2.46, 7.213}, {2.45513, 7.077}, {2.45028, 6.784}, {2.44545, 6.81}, {2.44063, 6.796}, {2.43584, 6.643}, {2.43106, 6.633}, {2.42631, 6.323}, {2.42157, 5.994}, {2.41685, 6.198}, {2.41214, 6.063}, {2.40746, 5.797}, {2.40279, 5.808}, {2.39815, 5.684}, {2.39352, 5.506}, {2.38891, 5.307}, {2.38431, 5.531}, {2.37974, 5.207}, {2.37518, 5.193}, {2.37063, 5.247}, {2.36611, 4.985}, {2.3616, 4.882}, {2.35711, 4.696}, {2.35264, 4.501}, {2.34819, 3.966}, {2.34375, 4.399}, {2.33932, 4.297}, {2.33492, 4.154}, {2.33053, 4.011}, {2.32616, 3.853}, {2.3218, 3.654}, {2.31746, 3.521}, {2.31314, 3.505}, {2.30883, 3.519}, {2.30454, 3.627}, {2.30026, 3.49}, {2.296, 3.412}, {2.29176, 3.624}, {2.28753, 3.43}, {2.28332, 3.345}, {2.27912, 3.503}, {2.27494, 3.2}, {2.27077, 3.169}, {2.26662, 3.015}, {2.26249, 2.968}, {2.25836, 2.76}, {2.25426, 2.523}, {2.25017, 2.624}, {2.24609, 2.567}, {2.24203, 2.654}, {2.23798, 2.525}, {2.23395, 2.413}, {2.22993, 2.279}, {2.22593, 2.262}, {2.22194, 2.47}, {2.21796, 2.288}, {2.214, 2.324}, {2.21006, 2.204}, {2.20612, 2.224}, {2.20221, 2.316}, {2.1983, 2.183}, {2.19441, 2.323}, {2.19053, 2.085}, {2.18667, 1.981}, {2.18282, 2.047}, {2.17898, 2.096}, {2.17516, 2.062}, {2.17135, 2.091}, {2.16756, 2.057}, {2.16377, 2.06}, {2.16, 2.048}, {2.15625, 2.231}, {2.1525, 1.956}, {2.14877, 2.066}, {2.14506, 2.082}, {2.14135, 2.019}, {2.13766, 2.184}, {2.13398, 2.043}, {2.13031, 1.94}, {2.12666, 1.985}, {2.12302, 2.172}, {2.11939, 2.175}, {2.11577, 2.161}, {2.11217, 2.184}, {2.10857, 2.082}, {2.10499, 1.994}, {2.10143, 2.081}, {2.09787, 2.066}, {2.09433, 2.239}, {2.0908, 2.167}, {2.08728, 2.192}, {2.08377, 2.207}, {2.08027, 2.3}, {2.07679, 2.342}, {2.07331, 2.346}, {2.06985, 2.37}, {2.0664, 2.391}, {2.06297, 2.436}, {2.05954, 2.321}, {2.05612, 2.433}, {2.05272, 2.528}, {2.04933, 2.714}, {2.04594, 2.569}, {2.04257, 2.682}, {2.03921, 2.621}, {2.03587, 2.899}, {2.03253, 3.089}, {2.0292, 3.136}, {2.02589, 3.259}, {2.02258, 3.158}, {2.01929, 3.147}, {2.016, 3.295}, {2.01273, 3.279}, {2.00947, 3.294}, {2.00622, 3.47}, {2.00298, 3.481}, {1.99975, 3.544}, {1.99652, 3.882}, {1.99332, 4.078}, {1.99012, 3.939}, {1.98693, 4.153}, {1.98375, 4.395}, {1.98058, 4.377}, {1.97742, 4.471}, {1.97427, 5.051}, {1.97113, 5.072}, {1.968, 5.454}, {1.96488, 5.711}, {1.96178, 6.012}, {1.95868, 6.169}, {1.95559, 6.691}, {1.95251, 7.021}, {1.94944, 7.428}, {1.94638, 7.902}, {1.94333, 8.348}, {1.94028, 9.005}, {1.93725, 9.836}, {1.93423, 10.504}, {1.93122, 11.491}, {1.92821, 12.563}, {1.92522, 13.621}, {1.92224, 14.784}, {1.91926, 16.286}, {1.91629, 17.614}, {1.91334, 19.183}, {1.91039, 20.854}}

when a should be around $50$, b around $5$-$7$ and c around $1.88$. We both have the same initial guesses. What does the << >> mean and why am I getting such bad results?

Data:

Mathematica:

EDIT: Added Data

  • weird <<...>> symbol. About your fit, without data I can only suggest to adjust the starting parameters. Maybe you can add some constraints if you know the context. Take a look at similar questions around. – Kuba Oct 5 '13 at 22:02
  • Your model is a monotonic function of x, so it looks like a bad choice as a fit to your data. – b.gatessucks Oct 5 '13 at 23:54

Your problem is that the Square root function is returning complex numbers (because its argument is negative). You can bypass this:

nlm = NonlinearModelFit[data, a*Re[Exp[-b*Sqrt[x - c]]], {{a, 45}, {b, 2}, {c, 1.8}}, x]

which gives

Normal[nlm]

4.73332 Re[E^(0.781405 Sqrt[-2.3218 + x])]

However, your data is not well fit by this function for reasons that b.gatessucks pointed out in a comment.

  • You can also add a constraint to the model, like c<=Min[data[[All,1]]]. – b.gatessucks Oct 6 '13 at 10:11

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.