Output of dependent variables in ode solver
1 view (last 30 days)
Show older comments
Hello, I am using ode15s to calculate the temperature of a room with air conditioning. Now I want to save the used cooling power of the chiller which is calculated as a result of the temperature. How can I add this value to the results? I´ve seen a different complex solutions, but there must be an easier way because in simulink you can just add an output to each variable you want to. Thanks in advance for your answers :)
0 Comments
Answers (2)
Torsten
on 8 Dec 2016
As a result from the call to ode15s, you get the temperature TEMP at different times in an array:
[T,TEMP]=ode15s(...)
Now just use a loop over the length of T to calculate cooling power of the chiller:
for i=1:numel(T)
TEMP_AKTUELL = TEMP(i,1);
COOLING_POWER_OF_THE_CHILLER(i)= function(TEMP_AKTUELL);
end
Best wishes
Torsten.
0 Comments
Christian Teicht
on 8 Dec 2016
4 Comments
Torsten
on 9 Dec 2016
Recalculate the value in OutputFcn from the solution y which is supplied in "keepvalues".
Best wishes
Torsten.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!