Prev: transparency in 3D plots
Next: int quadgk disagree
From: Aurelie Chabaud on 9 Jul 2010 06:00 I would like to fit non-linear data points I have collected from FRAP experiments. The function to be fitted is an infinite serie : f = Somme (((-b)^n/factorial(n))/(1+n*(1+2*t/tauD))) with n=1 to 100 I need to find the best value for my parameters b and tauD. I have tried to use the curve fitting tool but the function was not accepet as custom equation. I'm totally novice in matlab so I would be pleased if someone could help me.
From: John D'Errico on 9 Jul 2010 07:24 "Aurelie Chabaud" <aurelie.billon(a)univ-nantes.fr> wrote in message <i16rvl$hmf$1(a)fred.mathworks.com>... > I would like to fit non-linear data points I have collected from FRAP experiments. The function to be fitted is an infinite serie : > f = Somme (((-b)^n/factorial(n))/(1+n*(1+2*t/tauD))) with n=1 to 100 > I need to find the best value for my parameters b and tauD. > > I have tried to use the curve fitting tool but the function was not accepet as custom equation. > > I'm totally novice in matlab so I would be pleased if someone could help me. ARGH! Don't do it. 100 terms of this series will yield numerical garbage. factorial(100) ans = 9.3326e+157 Remember, that you are working in FLOATING POINT ARITHMETIC, in double precision. So you have about 16 digits of accuracy to work with. No more. As a rough guess, any more than about 5 terms of this series is probably a waste of time. John
From: Walter Roberson on 9 Jul 2010 15:15 John D'Errico wrote: > "Aurelie Chabaud" <aurelie.billon(a)univ-nantes.fr> wrote in message > <i16rvl$hmf$1(a)fred.mathworks.com>... >> I would like to fit non-linear data points I have collected from FRAP >> experiments. The function to be fitted is an infinite serie : >> f = Somme (((-b)^n/factorial(n))/(1+n*(1+2*t/tauD))) with n=1 to 100 >> I need to find the best value for my parameters b and tauD. >> >> I have tried to use the curve fitting tool but the function was not >> accepet as custom equation. >> >> I'm totally novice in matlab so I would be pleased if someone could >> help me. > > ARGH! Don't do it. > > 100 terms of this series will yield numerical garbage. > > factorial(100) > ans = > 9.3326e+157 > > Remember, that you are working in FLOATING POINT > ARITHMETIC, in double precision. So you have about > 16 digits of accuracy to work with. No more. > > As a rough guess, any more than about 5 terms of this > series is probably a waste of time. Unfortunately the sum is divergent for some values of b, t, and tauD . In particular, when tauD is near -2*t then the difference between the sum to 100 and the sum to 101 can range from -infinity to +infinity, and so the sum cannot be truncated. A symbolic summation to infinity can be done, yielding -b * tauD * hypergeom( [1, (2*tauD+2*t)/(tauD+2*t)], [2, (3*tauD+4*t)/(tauD+2*t)], -b) / (2*tauD+2*t) This has poles at tauD = -t and at tauD = -2*t . It thus seems to me that the fitting will have no solution, not unless tauD is constrained (e.g., to be the same sign as t).
From: Roger Stafford on 9 Jul 2010 17:57 "Aurelie Chabaud" <aurelie.billon(a)univ-nantes.fr> wrote in message <i16rvl$hmf$1(a)fred.mathworks.com>... > I would like to fit non-linear data points I have collected from FRAP experiments. The function to be fitted is an infinite serie : > f = Somme (((-b)^n/factorial(n))/(1+n*(1+2*t/tauD))) with n=1 to 100 > I need to find the best value for my parameters b and tauD. > > I have tried to use the curve fitting tool but the function was not accepet as custom equation. > > I'm totally novice in matlab so I would be pleased if someone could help me. - - - - - - - - - - Provided your t satisfies abs(2*t/tauD) < 1, and regarding your series as an infinite series rather than stopping at n = 100, this series is absolutely convergent and defines an analytic function of t in that circle in the t-complex plane. As you may know, even though the series may be divergent outside this circle, such analytic functions can usually be analytically continued to other regions beyond the circle of convergence. That is apparently true in your case. Walter has provided you with that analytic function using the generalized hypergeometric function. This can serve as an alternative method of evaluating your f quantity rather than having to perform the summation. Even though 'hypergeom' is capable of performing numeric computation, it is contained in the symbolic toolbox, so you would need that toolbox. As Walter points out, you will have to stay well away from the two poles at t = -tauD and t = -tauD/2. Roger Stafford
From: Roger Stafford on 9 Jul 2010 20:45
In my previous posting I should have said that Walter's generalized hypergeometric solution is analytic in the variable b and has an infinite radius of convergence in b, (though I believe it is also analytic in t as well.) It remains as an alternate method of evaluating the infinite series. Also it remains true that t must be kept away from -tauD and -tauD/2. Roger Stafford |