iterations / trial and error method to find a variable.

12 Ansichten (letzte 30 Tage)
Tarek Chaabo
Tarek Chaabo am 12 Mai 2018
Kommentiert: dpb am 13 Mai 2018
I have this enthalpy equation where all the variables are known but the temperature T2. I want to write a code to find the best possible solution for T2 by iteration / trial and error method. you can start from T2= 400 for instance.
deltah=a(T2-T1)+(b/3)*(T2^2-T1^2)+(c/3)*(T2^3-T1^3)+(d/4)*(T2^4-T1^4)
a=28.9; b=0.1967*10^-2; c=0.4802*10^-5; d=-1.966*10^-9; dltH=8900; T2=400; T1=300;

Akzeptierte Antwort

Jan
Jan am 12 Mai 2018
Bearbeitet: Jan am 12 Mai 2018
You can use fzero to solve this 3rd order polynomial.
  3 Kommentare
Tarek Chaabo
Tarek Chaabo am 13 Mai 2018
thank you so much i learned something new. Is there another way where i can see each value of T2 printed to the command window until the final value of 593.8714 ??
dpb
dpb am 13 Mai 2018
Read the documentation; specifically look at the additional, optional input argument list...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Debugging and Analysis finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by