How to solve exponential variables
이전 댓글 표시
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
KALYAN ACHARJYA
2023년 5월 15일
It seems like a home work question, what you've tried so far?
Image Analyst
2023년 5월 15일
Did you even try to adapt my code below?
Thomas Bulenga
2023년 5월 15일
이동: John D'Errico
2023년 5월 15일
Image Analyst
2023년 5월 15일
이동: John D'Errico
2023년 5월 15일
This is also not an exponential growth:

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.
채택된 답변
추가 답변 (2개)
Image Analyst
2023년 5월 15일
0 개 추천
See attached demo. Adapt it to use your data instead of the data created by the demo code.

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.
카테고리
도움말 센터 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





