Why does solve function return an empty value in a for cycle?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Giorgio Ceresoli
el 29 de Mayo de 2020
Comentada: Giorgio Ceresoli
el 29 de Mayo de 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 comentarios
Respuesta aceptada
darova
el 29 de Mayo de 2020
You have cubic equation
It means that you have 3 roots
try
T_gp_out(i)=double(sol(1)); % choose first root
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Number Theory en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!