For loop or if condition?
Mostrar comentarios más antiguos
Hi,
I solved system of differential equations that present temperature values in two rooms. Now, I want to apply thermostat control which is active if temperature drops below 18 or go above 20 degrees. Is this loop correct?
for i=1:t t(i)=84600; if(T(i)>=18 && T(i)<=20) go else stop end end
Or is better to use if statement?
Thanks in advance!
1 comentario
Nikola
el 5 de Sept. de 2013
Respuesta aceptada
Más respuestas (1)
Nikola
el 23 de Ag. de 2013
0 votos
6 comentarios
UJJWAL
el 23 de Ag. de 2013
as I said, put the question in clear words and describe the problem very well. only then I can be of some help.
Nikola
el 23 de Ag. de 2013
UJJWAL
el 23 de Ag. de 2013
Hello,
Since you have not given any mathematical formulation of thermostat and since I am not familiar with this subject, I will assume that something has to be done to turn off the thermostat and something else has to be done to turn it on. Consider the following piece of code and let me know if it is clear and helpful
if T>20
% Some code to turn off the thermostat
else
if T<18
% Some code to turn on the thermostat
end
Nikola
el 23 de Ag. de 2013
Nikola
el 27 de Ag. de 2013
Nikola
el 28 de Ag. de 2013
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!