Custom equation in curve fitting

조회 수: 3 (최근 30일)
JuiChun Lin
JuiChun Lin 2018년 6월 13일
댓글: Walter Roberson 2019년 12월 4일
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