Simulink or for-loop?
显示 更早的评论
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 个评论
Mathieu NOE
2020-11-13
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
2020-11-13
Mathieu NOE
2020-11-15
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
2020-11-15
Mathieu NOE
2020-11-16
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
2020-11-19
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 General Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!