How to solve exponential equations.

9 Ansichten (letzte 30 Tage)
Onkar Khadke
Onkar Khadke am 10 Sep. 2020
Bearbeitet: Image Analyst am 7 Aug. 2021
Hello, I have 70 data points in (X and Y) with four unknowns a, b, c, d. I have one exponential equation as y = a*[1-exp(-b*x)] + c*[exp(d*x)-1]. How to find all four unknowns that satisfy all 70 equations?
  2 Kommentare
Nidhi
Nidhi am 7 Aug. 2021
@Onkar Khadke Hi Onkar. I am trying to solve a similar problem and I am unable to understand how we can guess the initial parameters to find the unknown constants. Were you able to understand it. If yes, can you please help me understand.
Thanks in advance!
Image Analyst
Image Analyst am 7 Aug. 2021
Bearbeitet: Image Analyst am 7 Aug. 2021
@NDC, usually you can plot the data and just manually take a guess. Like pick some formula and try some values and see what gets you in the ballpark. Then use those as initial guesses and let fitnlm() get them more accurate. I'm attaching exponential decay and growth demos.
Start your own question and attach your data if you still need more help. Also say if you have other data if it looks roughly similar or wildly different.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

John D'Errico
John D'Errico am 10 Sep. 2020
Bearbeitet: John D'Errico am 10 Sep. 2020
Thank you for posting this as a question instead of an answer.
The simplest way to solve this is if you have the curve fitting toolbox. (If you do curve fitting often, then any of the curve fitting toolbox, the optimization toolbox or the stats toolbox will all be tremendously useful, and can all solve the problem. The CFTB is perhaps the solution I would tend to gravitate to here, because of the ease of use and nice way the results are presented.)
I don't have your data, so I cannot show the complete solution as I would want. But this should work:
mdl = fittype('a*(1-exp(-b*x)) + c*(exp(d*x)-1)','indep','x')
mdl =
General model:
mdl(a,b,c,d,x) = a*(1-exp(-b*x)) + c*(exp(d*x)-1)
fittedmdl = fit(X(:),Y(:),mdl,'start',abcdstart)
In this, you will need to provide a vector of length 4 (abcdstart) with starting values for the parameters [a,b,c,d]. If you do not do so, then expect possibly random garbage for a result.
By the way, note my use of parens in the model line, where you used square brackets. While what you wrote would work, it is also a good way to cause potential problems, because square brackets are used to concatenate data in MATLAB.
I'm sorry that I cannot help you more, but without seeing your data, I cannot be more complete with my answer. Given your data, I could then be able to recommend viable starting values. The problem with exponential models is they are HIGHLY susceptible to problems in the fits, depending on the data. You will often need to provide at least semi-intelligent starting values. The random start point supplied by fit as a default is often inadequate for such models.

Ameer Hamza
Ameer Hamza am 10 Sep. 2020
Bearbeitet: Ameer Hamza am 10 Sep. 2020
If you don't have curve fitting toolbox, then alternatives from the optimization toolbox are
For example
f = @(p, x) p(1)*(1-exp(-p(2)*x)) + p(3)*(exp(p(4)*x)-1);
xdata = % [70x1] vector of x values
ydata = % [70x1] vector of y values
sol = lsqcurvefit(f, rand(1,4), xdata, y);
a = sol(1);
b = sol(2);
c = sol(3);
d = sol(4);

Kategorien

Mehr zu Least Squares finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by