Simulink repeated operations (for loop)

4 ビュー (過去 30 日間)
Marco Asperti
Marco Asperti 2020 年 11 月 7 日
コメント済み: Marco Asperti 2020 年 11 月 7 日
Hi everyone,
I would like to implement in Simulink (at each time step) the following operation to orthonormalize a matrix A with an iterative method.
Starting from matrix A (3x3, computed inside the model), I would like to perform the following operation in a subsystem block:
for i = 1:5
A = 3/2*A-1/2*A*transpose(A)*A
end
I perfectly know how to perform the various operations (sums, products and transpose), but I don't know how to implement this for loop. What I want is a subsystem which takes as an input A, and gives as an output A orthonormalized iteratively by applying the formula above.

回答 (1 件)

Mark McBroom
Mark McBroom 2020 年 11 月 7 日
create a subsystem and use simulink blocks to create your equation inside the subsystem. The subsystem will have one input and one output. OUtside of the subsystem, connect theoutput of the subsystem to the input, with a unit delay to break the loop. Then, put this whole thing inside a for-each subsystem.
  1 件のコメント
Marco Asperti
Marco Asperti 2020 年 11 月 7 日
But what if I have matrix A (input) computed at each time step of integration in a larger system, and I want to repeat this procedure at each time step? How do I set the initial condition in the Unit Delay, to use the current A as initial value in the for loop at each time step?

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

カテゴリ

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

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by