Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Error while using function block in simulink

5 Ansichten (letzte 30 Tage)
shahar lutati
shahar lutati am 25 Feb. 2016
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
Hi, For a large system i'm trying to simulate i had to write specific code as block in simulink. for simplicity i first tried to do the following simple task (the real function is more complicated but as a sainity check):
But i get the following error:
I would really appriciate any help.

Antworten (1)

Sebastian Castro
Sebastian Castro am 25 Feb. 2016
This is an algebraic loop, which means that the output of the block depends directly on the input.
In this case, y cannot be computed without knowledge of u -- both of which refer to the same signal. As the error messages say, this is not valid.
If it makes sense given your modeling requirements, I would recommend using a Unit Delay block in the loop. This delay will change the equations from:
y = u (AT THE CURRENT TIME STEP) + randn(1,2); % Does not work
to:
y = u (AT THE PREVIOUS TIME STEP) + randn(1,2); % Will work
Just make sure the Unit Delay block is sampled at the rate you want by setting its sample time parameter.
- Sebastian

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by