Custom equation in curve fitting
4 views (last 30 days)
Show older comments
So i was trying to modify the customized equation in curve fitting tool but apparently it didn't work. This picture below is the fit I'm trying to modify....my equation is a*exp(b*(x-0.4))+c*exp(d*x)....the b,c,d, values are correct but a is not.

But when I tried to enter it as a custom equation

it gave me a straight line. I don't know what to do to fix that. Thanks
0 Comments
Answers (2)
Walter Roberson
on 13 Jun 2018
Can you attach your data? For that matter, we are still waiting to see your data for https://www.mathworks.com/matlabcentral/answers/404992-curve-fit-exactly-the-function-i-enter
Notice that all of the coefficients cross 0, and are all of the form (-V, V) . That tells you that the model the fit was about equally as good with negative coefficients as with positive coefficients.
When you see large negative coefficients being used within exp() then what it tells you is that the fit was trying to drive the associated term to 0. That can happen if you used a starting point that happened to be outside the basin of attraction of the good solutions: the fit starts to head towards the asymptopes of a bad solution.
When I look at your graph, it seems to me that you should be trying with x+1 or so rather than x-0.4
See https://www.mathworks.com/matlabcentral/answers/403639-exponential-fit-not-working#answer_322886 for how I dealt with this same curve shape for someone else recently.
4 Comments
Walter Roberson
on 14 Jun 2018
An a coefficient close to 0.1 is not a good fit. You would get a marginally better fit from omitting either of the two terms, making it a single exponential instead of a sum of two exponentials -- that's how poor a fit using 0.1 is.
To get a good fit you need to have either large a values with c near -1, or else small a values with c near 129.
serkantekbiren
on 4 Dec 2019
How can you add a b c d coefficients of the graph?
3 Comments
serkantekbiren
on 4 Dec 2019
Edited: serkantekbiren
on 4 Dec 2019
I am sorry. I am very new to matlab. That might have sounded like a stupid question. I have managed to plot my time based fouling rating data in curve fitting tool. Similar to what JuiChun Lin's pictures show, I have a similar custom equation used. However, I can not display the coefficients on the figure. Is there any way to display a,b,c and d coefficients on the figure ?
Walter Roberson
on 4 Dec 2019
Are you relying on the plot from the Curve Fitting Tool, or are you doing your own plot() of the curvefitting object? If you are using the Curve Fitting Tool then we need to fight to find the (hidden) graphics objects of the tools, but if you are doing the plot() yourself then you would know the axes and would be able to text() or title() the coefficients into place.
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!