sol = 
How to iteratively solve when equations are dependent on each other.
Show older comments
I have two equations, I know the varibles T_oQlast, K_dot_nom, and Sigma_ysrtM which are attached. The top equation is typically used to solve for T_oQlast, but in my case I need to solve for T_o_calc so I rearranged it as you can see. GAMMA is calculated based on T_o_calc.
What funtion can I used to solve for T_o_calc? I have thought about using an interative solution, select a starting GAMMA1 of 50, then calculate T_o_calc for that GAMMA1. Recacluate GAMMA1 for this new T_o_calc. But I can't figure out a way to loop the code until it converges on a solution.
T_o_calc = (((T_oQlast+273.15)*GAMMA1)/(GAMMA1-log(K_dot_nom/0.91)))-273.15;
GAMMA1 = (9.9 * exp((((T_o_calc+273.15)/190)^1.66)+(((Sigma_ysrtM)/722)^1.09)));
Heres the Vpasolve code I tied out. equLeft is the T_o_calc equation solved for GAMMA1, equRight is the equation for GAMMA1. This didn't work for some reason, it gave back no results.
syms T_o_calc
eqnLeft = -(273.15*log(K_dot_nom/0.91)-T_oQlast*log(K_dot_nom/0.91))/(T_o_calc-T_oQlast);
eqnRight = (9.9 * exp((((T_o_calc+273.15)/190)^1.66)+(((Sigma_ysrtM)/722)^1.09)));
T_o = vpasolve(eqnLeft == eqnRight, T_o_calc);
4 Comments
load('Sigma_ysrtM.mat')
load('T_oQlast.mat')
load('K_dot_nom.mat')
syms T_o_calc
eqnLeft = -(273.15*log(K_dot_nom) - T_oQ*log(K_dot_nom))/(T_o_calc + 546.3 - T_oQ);
eqnRight = (9.9*exp((((T_o_calc + 273.15)/190)^1.66) + (((Sigma_ysrtM)/722)^1.09)));
hold on
fplot(eqnLeft, [-650, -100])
fplot(eqnRight, [-650, -100])
hold off
legend('eqnL', 'eqnR', 'location', 'northwest')
grid on
John
on 27 Jul 2025
Hi @John, Based on your corrected equations, there is an intersection around T_o_calc = -170. You can try out the approaches by @Star Strider and @Torsten.
load('Sigma_ysrtM.mat')
load('T_oQlast.mat')
load('K_dot_nom.mat')
syms T_o_calc
eqnLeft = -(273.15*log(K_dot_nom) - T_oQ*log(K_dot_nom))/(T_o_calc - T_oQ);
eqnRight = (9.9*exp((((T_o_calc + 273.15)/190)^1.66) + (((Sigma_ysrtM)/722)^1.09)));
hold on
fplot(eqnLeft, [-220, -140])
fplot(eqnRight, [-220, -140])
hold off
ylim([0, 100])
legend('eqnL', 'eqnR', 'location', 'northwest')
grid on
John
on 28 Jul 2025
Accepted Answer
More Answers (2)
Sigma_ysrtM = load("Sigma_ysrtM.mat").Sigma_ysrtM;
T_oQlast = load("T_oQlast.mat").T_oQ;
K_dot_nom = load("K_dot_nom.mat").K_dot_nom;
T_o_calc = fsolve(@(T_o_calc)fun(T_o_calc,Sigma_ysrtM,T_oQlast,K_dot_nom),300)
function res = fun(T_o_calc,Sigma_ysrtM,T_oQlast,K_dot_nom)
GAMMA1 = (9.9 * exp((((T_o_calc+273.15)/190)^1.66)+(((Sigma_ysrtM)/722)^1.09)));
res = T_o_calc - ((((T_oQlast+273.15)*GAMMA1)/(GAMMA1-log(K_dot_nom/0.91)))-273.15);
end
Categories
Find more on Annotations 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!

