Simulink + How to change tuning parameters (Gain parameters) during simulation at predefined time steps

1 次查看(过去 30 天)
I am using a fixed-step solver (ode4) with a fixed step size. I need to change the gain parameter of the Gain Function Block at predefined time steps during the simulation. Thereby the dimensions of the vectors or matrix (gain parameter) could also be changed.
The time where the change should happen is defined in the initial M-file in the workspace.
More precise: I would like to switch between different state space representations during a simulation, like
\Dot{x} = A x + B u
Y = C x + D u
To summarize – A, B, C and D should be updated at the predefined time step.
I tried to do this with set_param() but I wasn’t successful. Thanks in advance for any help.
Joe

回答(1 个)

Jorik
Jorik 2013-12-9
编辑:Jorik 2013-12-9
If your parameters will really cause a difference of dimensions, it will only be possible to do this with variable-size signals instead of changing parameters while running the simulation. At Model Update (Initialization) blocks like a Gain will get fixed dimensions. It is not possible to change these dimensions during a simulation.
Instead you need to work with variable-size signals. There is quite a bit of good documentation about this and you may want to start reading here if this is new to you: http://www.mathworks.com/help/simulink/ug/variable-size-signal-basics.html
You could use a Multiply block instead of the Gain block and then you can have a Switch that switches between different "parameter" values at a predefined time (comparison with a Clock block). You could also program the logic of changing values and sizes in a MATLAB Function block.

类别

Help CenterFile Exchange 中查找有关 Configure Simulation Conditions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by