Solving 3 Simultaneous Exponential Equations

조회 수: 13 (최근 30일)
Rory Thornton
Rory Thornton 2019년 12월 20일
댓글: Rory Thornton 2019년 12월 22일
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!

채택된 답변

Star Strider
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
Rory Thornton
Rory Thornton 2019년 12월 20일
Great, fits the rest of my data really well too.
Thank you so much!
Star Strider
Star Strider 2019년 12월 20일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

David Goodmanson
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.
  댓글 수: 1
Rory Thornton
Rory Thornton 2019년 12월 22일
Thank you! It's just a line of best fit, there will be many viable solutions which may have very different a/b/c values. This fits the data well too.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by