Simulink or for-loop?
Ältere Kommentare anzeigen
I am trying to model a solar water heating system monitoring every second in one day. The problem is that these calculations (using for-loops) are quite slow, and two simulated hours can take as much as 15 minutes. My question for you is if it's perhaps better to use Simulink, since its specifically designed to handle a signal (solar irradiation, in this case). Is it faster, or slower?
I'm not using any add-ons but I'm open to suggestions.
6 Kommentare
Mathieu NOE
am 13 Nov. 2020
hello Christopher
it's difficult to answer your question without getting a bit more in the details of your computation
if you have lot of for loops , can you vectorize your code instead ?
IMHO, also Simulink is not the best choice if you still need lots of for loops
Christopher Norling
am 13 Nov. 2020
Mathieu NOE
am 15 Nov. 2020
Ok
I understand the complexity of the problem , but there is maybe a way to solve this without needing tons of for loops
I believe we need to find the equilibrium point of the entire installation
that should leave to solving a set of linear equations maybe with polynomial functions
do you have already a code that works ?
Christopher Norling
am 15 Nov. 2020
Mathieu NOE
am 16 Nov. 2020
OK
to be honest with you , I will not try to work on your symbolic code (simply I do not have the Symbolic Math Toolbox)
I would prefer to have first a document that describes the system and what are the governing equations , then I would like to see if I can find the equilibrium point with simple methods
are you interested to find the equilibrium point for a given condition only or are you triying to do a time simulation that covers one complete night / day cycle ?
Christopher Norling
am 19 Nov. 2020
Antworten (0)
Kategorien
Mehr zu General Applications finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!