Make Simulink remember the time, when a variable first exceeds a specific value

3 ビュー (過去 30 日間)
Max E.
Max E. 2015 年 9 月 2 日
編集済み: Max E. 2015 年 9 月 4 日
I want to implement some kind of storage that remembers something when something else happened. in my case i want to remember the simulation time when the velocity gets lower than 22.5 m/s. i tried to do it with a matlab-function-block that has to input ports (the velocity and a clock) and with the following code:
function y=f(v,t)
y=0
if v==22.5
y=t;
end
i thought this would do nothing after the velocity fell below 22.5, but in fact it sets y to 0. It feels like i chose a pretty odd way to achieve my goal, can you tell me how to do it better or how to get it to work?
  1 件のコメント
Max E.
Max E. 2015 年 9 月 4 日
編集済み: Max E. 2015 年 9 月 4 日
does nooone have an answer to this question, or does noone get, what i mean? It's really important to me!

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by