lmirosevic
lmirosevic

Reputation: 16307

How can the output of a Simulink block be fed back as an input?

I have 2 embedded Matlab functions which I am using to create a Simulink model. Both functions use the output of the second function as their input. I am getting an error at the moment indicating that this is an invalid loop.

Does anyone know how to implement this type of behaviour?

Screenshot showing the model and the error

Upvotes: 3

Views: 6793

Answers (1)

MikeT
MikeT

Reputation: 1644

You've created an algebraic loop, which means that to compute the inputs of the Embedded MATLAB block are directly dependent on the outputs of the block. This is not allowed when the loop is a "self-loop", i.e. there is only one block in the loop.

One way to fix this is to put Unit Delay block(s) somewhere on the signal feeding back into the Embedded MATLAB block. See the documentation on algebraic loops for more information.

Upvotes: 4

Related Questions