Why does solve function return an empty value in a for cycle?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Giorgio Ceresoli
am 29 Mai 2020
Kommentiert: Giorgio Ceresoli
am 29 Mai 2020
for i=1:N
syms Tout
sol=solve (energy_balance,Tout,'Real',true, 'IgnoreAnalyticConstraints',true);
T_gp_out(i)=double(sol);
end
Solve function returns an empty value at the second iteration of the for cycle which i am using.
When the solve function is run separately outside the for cycle it returns a real value.
I can't understand what is going wrong when all inputs and syntax are correct.
Should I define a syms vector function outside the for cycle?
Can someone help me?
Thanks in advance.
Giorgio Ceresoli
3 Kommentare
Akzeptierte Antwort
darova
am 29 Mai 2020
You have cubic equation
It means that you have 3 roots
try
T_gp_out(i)=double(sol(1)); % choose first root
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Number Theory 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!