Re-arranging an exponential function of 2 parts
2 次查看(过去 30 天)
显示 更早的评论
A curve fitting exercise on my data has shown that the best fit is achieved with a 2 part exponential method of form:
y = a*exp(b*x) + c*exp(d*x)
Whilst 'y' is the dependent variable (soil water content) and 'x' the independent variable (soil water potential), it would be useful if I could also rearrange the equation to calculate 'x' from known values of 'y'. This will help me to identify causes of this change.
I'm pretty new to logs and differentiation etc. Does anybody know a way to do this?
Cheers
Simon
0 个评论
回答(1 个)
Jonathan
2011-11-9
Simon,
There is no logarithm rule that allows you to solve for x explicitly. However, from differentiating we can see that if a*b and c*d are either both positive or both negative, then y(x) is monotone. This means that y(x) is a one-to-one function and has a well defined inverse. In this case, the function fzero can be used to determine the an x value from a y value. Here's how.
% Determine constants from a fitting routine. Dummy data here.
a = 1;
b = 2;
c = 3;
d = 4;
% Create an anonymous function for representing the fit.
f = @(x) a*exp(b*x) + c*exp(d*x);
% For a y value of interest, find x.
y_given = f(1); % This example y value corresponds to x = 1.
x_calculated = fzero(@(x) f(x) - y_given, 0);
Enjoy,
Jonathan
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Mathematics and Optimization 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!