How to solve exponential variables
Show older comments
I have this exponential equation.
Y = A + Bexp(−CX)
For various values of Y, A and X I need to determine values for B and C. Solve function doen't seem to work.
Any idea will be appreaciated.
6 Comments
KALYAN ACHARJYA
on 15 May 2023
It seems like a home work question, what you've tried so far?
Image Analyst
on 15 May 2023
Did you even try to adapt my code below?
Thomas Bulenga
on 15 May 2023
Moved: John D'Errico
on 15 May 2023
Image Analyst
on 15 May 2023
Moved: John D'Errico
on 15 May 2023
This is also not an exponential growth:

John D'Errico
on 15 May 2023
Edited: John D'Errico
on 15 May 2023
Please don't post an answer to your question, when it is merely a comment. Learn how to make a comment.
Regardless, there is no sign of exponential growth OR decay. You data does not fit the model that you want to pose. Now, I suppose, IF you discard the last data point, it MIGHT look like exponential growth, as there can be some curvature seen.
X = [2 4 6 8 10 12 16 20];
Y = [0.00357246 0.003976621 0.004660491 0.0055569 0.007139916 0.009158161 0.012885998 0.010789951];
plot(X(1:end-1),Y(1:end-1),'bo-',X(end),Y(end),'rs')
However that last data point will completely blow away any estimates of those coefficients. Even the next to last data point will be a significant problem.
Accepted Answer
More Answers (2)
Image Analyst
on 15 May 2023
0 votes
See attached demo. Adapt it to use your data instead of the data created by the demo code.

John D'Errico
on 15 May 2023
Edited: John D'Errico
on 15 May 2023
The problem is, you have been trying to SOLVE them.
More approproately, you want to use a tool that will FIT your model to the data. As such, the curve fitting toolbox would be a very good choice. You don't want to use the symbolic toolbox at all. No need to use syms or symvar.
I'm not at all sure why you want to define A as some fixed value though, instead of also estimating it. That seems utterly strange to me. But before we do ANYTHING, lets look at the data you are trying to fit.
% Define X and Y as simple vectors of data.
X = [2 4 6 8 10 12 16 20];
Y = [0.035 0.04 0.045 0.048 0.053 0.059 0.063 0.07];
plot(X,Y,'o')
LOOK AT THE PLOT.
An exponential curve does not look like that data. It will be curved, either going to infinity, or leveling out at some constant value. This data does neither of those thigns. So attempting to fit it with an exponential model will be a complete waste of your time. This is that you should expect to see in your data, IF an exponential model is appropriate:
fplot(@(t) exp(-t),[0,5])
fplot(@(t) exp(t),[0,5])
Your data is essentially a STRAIGHT LINE.
P1 = fit(X',Y','poly1')
plot(P1,X,Y,'bo')
Any attempt to fit an exponential model to that data is like trying to force a square peg into a round hole. The fit will be complete crapola.
Categories
Find more on Descriptive Statistics 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!




