How do I set a flag on Simulink?
30 ビュー (過去 30 日間)
古いコメントを表示
I'm trying to model a relatively simple mechanical system using Simulink, but there is a particular parameter (call it f) which seems to need computing logic that would normally require flags. Basically, if f ever exceeds a value, say 100, a separate parameter (call it s), has to evaluate to TRUE. Then, s must remain TRUE until f drops below another value, say 50. How could I go about modeling this in Simulink?
In MATLAB, the logic would go something like this, checking continuously for f:
s=0; %Initial Condition
if f>100
s=1;
end
if f<50
s=0;
end
0 件のコメント
採用された回答
Richard Zappulla
2017 年 2 月 3 日
You can use a relay block in the Discontinuities folder. You input your signal, f, into the block and set the Switch On Point to 100 and Switch Off Point to 50 and you should be good to go.
0 件のコメント
その他の回答 (1 件)
Dalton L'Heureux
2020 年 6 月 12 日
A relay block works great as already seggested. But incase anyone wants to do a similar thing using only basic logic blocks, you can define a simple latch as shown below:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!