0

I am new to the community. I have two dimensional data (x and y data). Each data point of y can be modeled using some equation for example: y = dln(1+(exp(x-a))/(bc)). I know the value of a and c. Now for fitting curve to data I assigned initial value for b and d as 1 and I can generate the following curve.

Fit vs Data curve

I know that if I increase b by some ratio let say b= b + .05 and decrease d by looking at the graph then I will eventually match the data points with some error. But this would be an iterative approach to increase b every time and check error for the fitting. Is there any optimization or fitting techniques that minimize error between ydata and y = dln(1+(exp(x-a))/(bc)) and gives the values for parameters that could generate the curve with minimum possible error. Do you know any techniques related to this problem. Thanks

frasheed
  • 75
  • 8

1 Answers1

0

If you know all parameters except b, in fact you can compute it for every point (x, y), using

b = exp(x-a)/(c(e^(y/d)-1)).

Then an "optimal" value can be the average or median value. But you'd better look at the distribution of those b first.


If you want a more rigourous solution, assuming uniform errors (?), you can resort to least-squares fitting.

For this you express the sum of (y - Fb(x))² on all points, where Fb is your model, and take the derivative on b. This will give you a (complicated) function for which you will find the roots, possibly using Newton's iterations. Finally, keep the root giving the smallest sum.

  • Hello Thank you for your help. I made a mistake in my question (sorry for that). 2 parameters (b and d) both are unknown and I can calculate them by changing their values and then looking at the graph. Do you think least square fitting would work in that case ? – frasheed Oct 03 '17 at 09:46
  • I am not sure (may be because of my limited knowledge). I will give it a try. I tried to solve similar issue (non linear curve fitting) with Matlab curve fitting tool but it couldn't find an optimum solution for that. I had to reduce the parameter bound to solve for it. Anyways I will give it a try Thanks! – frasheed Oct 03 '17 at 10:17
  • It worked, I used curve fitting tool using python and it could solved it. However, if I try to solve it using MATLAB then %error is high. Thanks for your help. – frasheed Oct 03 '17 at 15:01