Simulinkにおけるタイムステップの出力
21 views (last 30 days)
Show older comments
Simulinkにおけるシミュレーションにて,MATLAB function ブロックの計算に毎回のタイムステップを入力してシミュレーションを実施したいです.最適なブロックを教えてください.ちなみにタイムステップは固定ではなく可変のため,毎回測定して出力させたいです.
0 Comments
Accepted Answer
Shoumei
on 12 May 2020
現在時間ではなく、タイムステップということで、現在時間と前のステップとの時間差を取る必要があるのでこんなサンプルを作成してみました。MATLAB Functionブロック内でシミュレーション時間を取得する関数とかがあればもっと簡単に出来るかもしれません。
なお、差分を取るときはMATLAB Functionの中でpersistent変数を使うと良さそうですが、可変ステップではpersistentは使えないようです。
function [timeStep,nowOut] = fcn(nowIn, delayIn)
timeStep = nowIn - delayIn;
nowOut = nowIn;
0 Comments
More Answers (0)
See Also
Categories
Find more on パフォーマンスの手動最適化 in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!