Simulink: MatLab Fcn Block / Output equals Input at next timestep
2 views (last 30 days)
Show older comments
Hello everybody,
I am having trouble with Simulink, especially the Matlab Fcn Block.
One of the Inputs in the Fcn Block is an Output from the previous timestep.This does work like a loop. The Input is the output of the previous timestep. At Initialisation this Input is not important, the programm can run without it.
I tried using an Unit Delay Block, with an initialisation value of 0. The programm detects the value 0 and starts the initalisation process. From the second time step on, the programm uses the output from the previous timestep and continues calculating. In Matlab this process does work fine, the programm itself is not the problem.
The problem is the following: The output that gets fed back to the Fcn Block is a three-dimensional array. The Sizes of each dimension is not known prior to the start of the simulation, instead it is determined by another input parameter of the Fcn Block.
If I try to compile the model, I get the following error: (FCmodel is the name of my Fcn Block).
Block Unit Delay1 contains states that require resetting whenever the input signal sizes vary. This block property is inconsistent with a block property of FCmodel; the output signal sizes of block FCmodel depend on its input signal values. Consider placing 'Unit Delay1 in an Enabled/Function-Call/Action/Resettable Subsystem and setting the parameter 'Propagate sizes of variable-size signals' on the corresponding control port block to: 'Only when enabling' for an Enabled or a Function-Call Subsystem; 'Only when execution is resumed' for an Action Subsystem; or 'Only when resetting' for a Resettable Subsystem.
I tried to solve it according to the error message, but each try was unsuccessful. I guess the problem is that the size from the input signal gets changed from a scalar to a three dimensional array, but I do not know if and how this can be solved. I cannot set the initialisation value of the Unit Delay Block to the right sized array as the size of the array is not know prior to the simulation.
0 Comments
Answers (0)
See Also
Categories
Find more on Event Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!