how to use previous value in simulink? [(k-1) value]

12 ビュー (過去 30 日間)
Hyun Wook Kang
Hyun Wook Kang 2023 年 6 月 4 日
回答済み: Les Beckham 2023 年 6 月 5 日
Currently, I am designing filtered velocity of the two wheel balancing robot, using encoder, and accelerometer, using following 2 equation.
I am trying to use MATLAB function block in simulink, which is the following picture.
But there is an error which says that I can't use direct feedback..
Can somebody help me with this problem?
  1 件のコメント
Govind KM
Govind KM 2023 年 6 月 5 日
Could you share the exact error message?

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

採用された回答

Les Beckham
Les Beckham 2023 年 6 月 5 日
It looks like what you need to do is remove the new_filtered_V input from your MATLAB function block and add this line at the top of your code:
persistent new_filtered_V;
That will eliminate the direct feedback and then the code will use the remembered previous value of new_filtered_V to update the new value.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by