Hi,
I created some nested function but it reports the error. In the first function, I calculated values for temperatures x1 and x2. Then, I defined function result that represents thermostat which should determine should thermostat be on or off in each iteration. In case that thermostat does not work in each iteration, temperature raise. Here are the functions:
function xprime = heat_sys(t,x);params...xprime = (system of diff equat)function result = thermostat(x);on = true;off = false; for i=1:n(end) if(x(i,1)>=18 && x(i,1)<=20) result(i)=on; else if(x(i,1)<18) result(i)=on; else if(x(i,1)>20) result(i,1)=off; end; end; end;end;
By the way, is this right approach to do this or I could use something different also?
Thanks in advance!
Best Answer