# Re-arranging an exponential function of 2 parts

1 view (last 30 days)
Simon on 9 Nov 2011
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

Jonathan on 9 Nov 2011
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

### Categories

Find more on Mathematics and Optimization 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!