- #1
WhiteWolf98
- 86
- 5
- TL;DR Summary
- I basically want Q in the code to be 30,000 or something near to 30,000 (perhaps between two values, for example between 29,750 and 30,250). I don't know how to define the range though, and the code keeps going on infinitely
Matlab:
m_1 = 1;
C_p1 = 2219;
T_1in = 100 + 273.15;
T_1out = 75 + 273.15;
Q_1 = (m_1)*C_p1*(T_1in-T_1out);
while Q_1 ~= 30000
T_1outnew = T_1out + 0.1;
Q_1 = (m_1)*C_p1*(T_1in-T_1outnew);
T_1out = T_1outnew;
end
T_1outnew keeps increasing, but the code never stops; and naturally, Q becomes negative