Simulinkにおけるタイムステップの出力
22 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
kazuki watada
am 8 Mai 2020
Beantwortet: Shoumei
am 12 Mai 2020
Simulinkにおけるシミュレーションにて,MATLAB function ブロックの計算に毎回のタイムステップを入力してシミュレーションを実施したいです.最適なブロックを教えてください.ちなみにタイムステップは固定ではなく可変のため,毎回測定して出力させたいです.
0 Kommentare
Akzeptierte Antwort
Shoumei
am 12 Mai 2020
現在時間ではなく、タイムステップということで、現在時間と前のステップとの時間差を取る必要があるのでこんなサンプルを作成してみました。MATLAB Functionブロック内でシミュレーション時間を取得する関数とかがあればもっと簡単に出来るかもしれません。
なお、差分を取るときはMATLAB Functionの中でpersistent変数を使うと良さそうですが、可変ステップではpersistentは使えないようです。
function [timeStep,nowOut] = fcn(nowIn, delayIn)
timeStep = nowIn - delayIn;
nowOut = nowIn;
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu パフォーマンスの手動最適化 finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!