Solving 3 Simultaneous Exponential Equations
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Rory Thornton
le 20 Déc 2019
Commenté : Rory Thornton
le 22 Déc 2019
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 commentaires
Réponse acceptée
Star Strider
le 20 Déc 2019
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 commentaires
Plus de réponses (1)
David Goodmanson
le 21 Déc 2019
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.
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!