Custom equation in curve fitting

3 次查看(过去 30 天)
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

回答(2 个)

Walter Roberson
Walter Roberson 2018-6-13
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 个评论
JuiChun Lin
JuiChun Lin 2018-6-14
is there any ways that I can modify the code so that the first coefficient is near 0.1? (which is the correct value)
Walter Roberson
Walter Roberson 2018-6-14
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
serkantekbiren 2019-12-4
How can you add a b c d coefficients of the graph?
  3 个评论
serkantekbiren
serkantekbiren 2019-12-4
编辑:serkantekbiren 2019-12-4
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
Walter Roberson 2019-12-4
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by