How do I implement a delay in Stateflow?

I want to implement the equivalent of the Delay block from the Discrete Library of Simulink inside a Stateflow chart. My inputs can be a scalar, vector, matrix or a time varying signal.

 採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 11 月 23 日

2 投票

Delays may be implemented inside a Stateflow chart using transitions and temporary variables. Download the attached models (delaystate.mdl and delaystate1.mdl) and compare the simulation results obtained using delay blocks and the Stateflow chart.
Notes:
1. The number of temporary variables is equal to the number of times the input needs to be delayed.
2. The temporary variables in Stateflow charts cannot be used to resolve algebraic loops, like Unit-Delay Blocks (refer delaystate2.mdl).

1 件のコメント

Walter Roberson
Walter Roberson 2025 年 1 月 29 日
Ravi comments
Same model I am trying to implement but it is keep showing me error " Size for Local Data 'temp' may not be inherited" I tried to copy all the variable property of chart but even i am unable to develop same model.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStateflow についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by