How to change the initial condition of a block in the model with Simulink.Parameter?
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I want to change the initial condition of a Simulink block, like "Unit Delay" or in my case Biquad-Filter of the DSP System Toolbox. I want to set up the initial condition of the filter with the first valid value in order that the filter is faster at the designated value. In the model, the initial condition is not a constant and can varying at every system start or simulation run. It is not possible to set up this parameter in the properties as an input port. So I have to create an Simulink.Parameter in the Model Workspace for this initial condition. How can I set or write this Simulink.Parameter during the Simulation in the Simulink-model? I found a solution to set it via MATLAB or Command Window but not in Simulink. Has somenone an solution for this issue? Is there an alternative way?
In addition I have to generate C-Code with the Embedded Coder of this filter. So the solution might be work with the Embedded Coder as well and it should not be a global variable. The calculation and the setting of the initial condition are in one function, so that it should be sufficient a local variable.
Thanks a lot in advance!
Mario
0 Kommentare
Antworten (2)
Fangjun Jiang
am 16 Jan. 2020
The initial condition can be regarded as a state. Use the "State Writer" block. Follow examples.
https://www.mathworks.com/help/releases/R2019b/simulink/slref/statewriter.html
Siehe auch
Kategorien
Mehr zu Event Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!