Page 1 of 1
Curve Fitting
Posted: Fri Dec 02, 2005 12:45 am
by Matt
I am a novel user of Dplot and I need some help with the program to fit a curve of the following particular equation:
S = Su [k(t-t0)]^0.5 / {1 + [k(t-t0)]^0.5}
where Su, k and t0 are constants that need to be evaluated using Dplot
to fit the following experimental data:
x y
1 6.289406374
3 18.81297756
4 21.87605963
7 28.85260054
28 37.41608608
==================================
I have found the equation y = (ax+b)/x+c from Dplot as the closest matching equation to the one listed above.
I am wondering if there is a way to enter the actual equation in the program to obtain and values - directly? - If not, how can I proceed?
With thanks
Posted: Fri Dec 02, 2005 2:38 am
by DPlotAdmin
Matt,
The curve fit routine doesn't allow user-specified equations at this time. That's something I've been working on but am not satisfied with the results yet. I can add your equation form to the next release, that's no problem.
In the meantime if you're feeling adventurous and have plenty of time on your hands you can creep up on the solution by assuming values for one or two of the constants you're solving for and applying a transformation to X before using the curve fit routine. For example with an assumed k and t0 you'd use Edit>Operate on x with x=sqrt(k*(x-t0)), then in the curve fit routine select y=Ax/(x+B), with B forced to 1 and the "Hold" box checked for B. And now that I've written that down I probably deserve to be slapped for suggesting it... you could easily spend all day on this.
OR... if you have Excel you can use Solver to find a pretty decent fit, in this case Su=58.72121546, k=0.121419532, t0=0.885112451.
Posted: Fri Dec 02, 2005 3:35 am
by Matt
Thanks for your reply. You suggestions are certainly helpful.
The equation with parameters Su, k and t0 is the equation describing the strength gain of early age concrete - reported by Carino, N. J. It is a very popular equation in estimating the in-situ strength of concrete. I am sure it will draw a lot of interest.
Can I suggest that if did include that form of equation in your next version that you change the power of 0.5 to a constant n - please?
When will you update the program?
Cheers,
Matt
Posted: Fri Dec 02, 2005 4:46 am
by DPlotAdmin
Can I suggest that if did include that form of equation in your next version that you change the power of 0.5 to a constant n - please?
Sure, that's no problem. That is... it's no problem for
me. What that will do though is make it just about impossible for the curve fit procedure to guess at good initial values for the other coefficients, so you will have to enter those yourself on the Initial Values screen. In a lot of cases with exponential forms, without reasonably close initial values the procedure tends to blow up. So I'll add both
y=A*sqrt(B*(x+C))/(1+sqrt(B*(x+C))) and
y=A*(B*(x+C))^D/(1+(B*(x+C))^D)
When will you update the program?
Probably this weekend.
Posted: Fri Dec 02, 2005 5:13 am
by Matt
Wow... I am so glad that you can update the program this soon. How can I update my version accordingly, so that I can use the equations then?
It will save me so much time and I would be so grateful... I was thinking of learning Fortran or Matlab to solve this problem...
Thank you so much for your help!
Regards
Posted: Fri Dec 02, 2005 7:17 am
by DPlotAdmin
If you're a licensed user and aren't on the mailing list, you need to be. Send a message to
support@dplot.com with subject="DPlot mailing list" and include your name and registration number in the body of the message to subscribe.
If you aren't a licensed user, just check back over the weekend; version number will be updated on the home page when the new release is ready.
Posted: Fri Dec 02, 2005 4:22 pm
by DPlotAdmin
Matt,
I've copied a beta version of the new curve fit plugin here: [Edit: removed. These features are now included in the standard distribution]. Right-click that link, select "Save Target As", and copy to the \plugins\generate folder below DPlot. If you used the default installation path that will be c:\Program Files\DPlot\plugins\generate. Despite what I said earlier I'll probably hold off on a new DPlot version and/or distribute the old version of the curve fit plugin with the update until you've had a chance to break this thing.
The first form:
y=A*sqrt(B*(x+C))/(1+sqrt(B*(x+C)))
is relatively insensitve to the initial values; the default values of 1.0 for all coefficients should converge to a good solution, assuming the input can be represented by that equation. For your example I get:
A: 58.7215
B: 0.121417
C: -0.885111
correlation coefficient=0.99618
... which is very close to the values I reported earlier using Excel's Solver.
The second form:
y=A*(B*(x+C))^D/(1+(B*(x+C))^D) is much more sensitive to the initial values and will likely blow up with a trapped overflow if you leave all coefficients=1.0. If you don't have a rough idea of the "correct" answer, a good approach would be to first find the coefficients for y=A*sqrt(B*(x+C))/(1+sqrt(B*(x+C))), then plug those values of A, B, and C into the initial values for the 2nd form along with D=0.5. The coefficients don't need to be that close, though (at least not for your example). With the initial A=50 and all others=1.0, I get
A: 40.2186
B: 0.316712
C: -0.226144
D: 1.19588
and a correlation coefficient of 0.99979, which is pretty darn close to an exact fit.
I think I've trapped any potential overflow/underflow conditions that would make the plugin (and DPlot) crash, but I've been wrong before. If you're able to cause a crash please send me the data you were working with along with the initial values for the coefficients you used.
Posted: Fri Dec 02, 2005 8:11 pm
by Matt
Dear David:
There are no words to express how grateful I am for your help.
I followed your instructions and I have obtained similar results.
I will try the "power of n" version later on but I am sure it will run ok given that I have some knowledge of the constants as they are meant
to be very similar for the linear and sqroot functions.
I would certainly acknowledge your help in towards my work -
With thanks and regards,
m
Posted: Fri Dec 02, 2005 8:32 pm
by DPlotAdmin
There are no words to express how grateful I am for your help.
How about "I'll tell all my friends"? That would do nicely
Let me know if you hit any snags with this.
Posted: Fri Dec 02, 2005 9:01 pm
by Matt
Will certainly do that.
I've written an e-mail to
support@dplot.com but it did not get through.
Can I have your e-mail, please?
Cheers!
Posted: Fri Dec 02, 2005 9:33 pm
by DPlotAdmin
support@dplot.com is correct.
If you got a rejection, what did it say?
Posted: Fri Dec 02, 2005 11:37 pm
by Matt
It said the following:
"Diagnostic-Code: SMTP; 550 5.7.0 - Your message was rejected because it contains an unacceptable subject".
But, I've sent it again and this time it hasn't bounced back!
Cheers.
M
Posted: Sat Dec 03, 2005 12:09 am
by DPlotAdmin
No idea but I got this one. Thanks.
Posted: Sun Dec 04, 2005 11:41 pm
by Matt
David:
In one of your replies above, you've suggested to use Excel's solver feature to obtain the values of the constants... and you've actually, listed the constants that you've obtained using solver which are pretty good.
Could you e-mail the file containing the solver operation that you've carried out? I am not very familar with this feature and I want to trace back and see how you've listed the constraints etc.
Also, for the same st of data (listed above), there is yet another formulae (exponential):
S = Su e ^ -( t0 / t)^a
With constants Su, t0 and a to be evaluated.
Could help help with this one as well, please?
Cheers,
M
Posted: Sun Dec 04, 2005 11:58 pm
by DPlotAdmin
Matt,
Sent.
Other equation forms: Presently I'm in the thick of modifying the curve fit routine to work with user-defined functions. If I don't get this working to my satisfaction in the next few days I'll back up and add your equation.
Posted: Mon Dec 05, 2005 12:43 am
by Matt
I wish you all the best with your endevor.
Please, let me know when it is done.
and thanks for the attchment and the time taken to explain the procedure.
Cheers,