Solving 3 Simultaneous Exponential Equations
14 ビュー (過去 30 日間)
古いコメントを表示
I am trying to solve these 3 simultaneous exponential equations for a,b and c (This is from Vogels Viscosity Equation):
159.2543 = a*exp(b/(291.15-c))
117.2699 = a*exp(b/(293.15-c))
63.8384 = a*exp(b/(299.15-c))
I would really appriciate it if someone could show me how to write the code to solve them please!
Thank you in advance!
0 件のコメント
採用された回答
Star Strider
2019 年 12 月 20 日
Try this:
x = [291.15; 293.15; 299.15];
y = [159.2543; 117.2699; 63.8384];
% % % MAPPING: a = b(1), b = b(2), c = b(3)
objfcn = @(b,x) b(1).*exp(b(2)./(x - b(3)));
B0 = [0.07; 450; 230];
[B,normresid] = fminsearch(@(b) norm(y - objfcn(b,x)), B0)
xv = linspace(min(x), max(x));
figure
plot(x, y, 'p')
hold on
plot(xv, objfcn(B,xv), '-r')
hold off
grid
Values of:
a = 0.970
b = 180
c = 255
give a reasonable fit to the data.
2 件のコメント
その他の回答 (1 件)
David Goodmanson
2019 年 12 月 21 日
HI Rory,
just for completeness
y1 = 159.2543;
y2 = 117.2699;
y3 = 63.8384;
x1 = 291.15;
x2 = 293.15;
x3 = 299.15;
A1 = log(y1/y2)/log(y2/y3);
A2 = (x2-x1)/(x3-x2);
c = (x1*A1-x3*A2)/(A1-A2);
% back substitute
b = log(y1/y2)*(x1-c)*(x2-c)/(x2-x1);
a = y1/exp(b/(x1-c));
a
b
c
a =
10.6205
b =
42.5004
c =
275.4539
% these should be small
y1 - a*exp(b/(x1-c))
y2 - a*exp(b/(x2-c))
y3 - a*exp(b/(x3-c))
ans =
0
ans =
-4.2633e-14
ans =
-7.1054e-14
The c result is fairly close to Star Strider's, but for some reason a and b differ from that result by quite a bit. The checks here show agreement at all three y points, but the best fit isn't necessarily the one that goes through all three points exactly.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!