How to solve non-linear langmuir type equations which have 4 variables?

2 次查看(过去 30 天)
Hi
I want to solve the langmuir type equations which have 4 unknown constants.
The equation is
k*a*p*c*(aer)^2*(x-xeq)/(1+(a*p)^0.5+b*0.03)^3-y=0
The variables are k a b c p, aer, xeq are the parameters for the conditions.
p = [0.97 0.8 0.5 0.3]
aer = [0.6 0.5 0.4 0.36]
xeq = [2.2e-10 2.6e-10 4.2e-10 7.1e-10]
x and y are the experimental data at each conditions.
For example,
if [p, aer, xeq] = [0.97, 0.6, 2.2e-10], we have 2~3 pairs of [x, y].
So with this condition, I want to estimate the 4 unknown values, a, b, c, k.
I have start the study of MATLAB just yesterday, so the answer with detail like whole function definition and codes will be very helpful for me.
Thanks.
  2 个评论
Torsten
Torsten 2017-8-25
编辑:Torsten 2017-8-25
Use MATLAB's "lsqcurvefit".
Note that k and c cannot be determined independently from each other.
Reformulate your equation as
kc*a*p*(aer)^2*(x-xeq)/(1+(a*p)^0.5+b*0.03)^3-y=0
with the three variables kc, a and b to be determined.
Best wishes
Torsten.
HYOJAE LEE
HYOJAE LEE 2017-8-28
Thank you so much for your comments.
Now I understand I have to use lsqcurvefit. But I couldnt understand why k and c cannot be determined independently from each other.
And also I want to know how to construct code in order to fit my data to model for the the four combinations of [p aer xeq].
myfun = @(x,xdata) (x(1).*x(2).*p.*(aer).^2.*(xdata-xeq)./(1+(x(2).*p).^0.5+x(3).*0.03).^3);
ydata = [0.3 0.4; 0.2 0.4; 0.3 0.4; 0.4 0.5];
xdata = [1.4e-9 1.8e-9; 1.5e-9 2.9e-9; 9.6e-9 1.1e-8; 1.07e-8 1.46e-8];
x0 = [10000000 0.001 2000];
lb = [1e-5; 1e-5];
ub = [1e8; 1e8];
p = [0.97; 0.8; 0.5; 0.3];
aer = [0.6; 0.5; 0.4; 0.36];
xeq = [2.2e-10; 2.6e-10; 4.2e-10; 7.1e-10];
[x, resnorm, residual, exitflag, output, lambda, jacobian] = lsqcurvefit(myfun, x0, xdata, ydata, lb, ub);
Thus i tried to make my code but i couldnt make it run. I got some error like this:
"lsqcurvefit stopped because the final change in the sum of squares relative to its initial value is less than the default value of the function tolerance."
I want to know (1)the structure of the code is correct or not and (2) how to set x0, lb and ub.

请先登录,再进行评论。

回答(1 个)

John D'Errico
John D'Errico 2017-8-25
编辑:John D'Errico 2017-8-25
So, for each combination of p,aer,xeq, you wish to estimate a,b,c,k variables. To do this at each such combination you say that you have 2-3 pairs of data points, thus (x,y) pairs?
You cannot estimate 4 variables using 2 or 3 data points! That is impossible. Any solution that is found (assuming one is possible) will be only one of infinitely many solutions. So the solution will be not a useful solution.
While Torsten told you to use lsqcurvefit, that would be appropriate only if you have more data points that you have parameters to estimate.
The answer is you need to get more data. To have any realistic chance of being able to get good estimates for 4 variables, even 10 data pairs would be the minimum I would normally suggest, and more is always better. How many you really need depends on how much noise there is in your data. But at a bare minimum, you absolutely need at least 4 pairs of (x,y).
  1 个评论
Torsten
Torsten 2017-8-25
As I understood the OP, he/she has 2-3 pairs of [x,y] for the four combinations of [p aer xeq], thus 8-12 pairs of [x y] in total.
Best wishes
Torsten.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 非線形方程式系 的更多信息

Community Treasure Hunt

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

Start Hunting!