Calling a Simulink model by using feval
古いコメントを表示
I am working on a Simulink model. There is a trim code which is calling this model by using feval as follows.
feval(model,0,x0,u0,'compile')
Y = feval(model,0,x,u,'outputs')
Xd = feval(model,0,x,u,'derivs')
feval(model,[],[],[],'term')
However, it only gives the outputs of the model but I need the outputs from to workspace blocks too. How can I obtain these outputs?
And also I would like to ask is there any documentation about this kind of usage of feval.
6 件のコメント
Luca Ferro
2023 年 4 月 18 日
is there a reason why you use feval() instead of sim()?
Yusuf Bayrak
2023 年 4 月 18 日
Luca Ferro
2023 年 4 月 19 日
do you have data that supports the claim that feval is actually faster than sim? Anyways, let's assume you are right, is speed really a concern for you? if not, sim does exactly what you need in one line
Yusuf Bayrak
2023 年 4 月 19 日
Sara Nadeau
2023 年 4 月 19 日
The sim function does much more than what you're calling inside feval here, which is part of the time difference that you're seeing. When you tried sim, how did you configure the simulation?
Depending on what you are doing, you might be able to use options such as fast restart to cut down on the amount of time the sim requires. When you enable fast restart, the software compiles the model only for the first simulation. Subsequent simulations skip the compilation step, which can save time.
To ensure that skipping compilation still produces accurate results, the software prevents you from modifying the model in ways that would require recompilation while fast restart is enabled for the model.
If you are running iterative simulations and you don't need to make such changes, fast restart can probably help speed up the usage of sim here.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Naming Conventions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!