MATLAB: Is there an example of using SET_PARAM command in a MATLAB file S-function to update a parameter of any block in the model

%sfunctionmfiles-fcnsimulinktune

I have a Rate Limiter block in my model and I would like to change the Initial Condition parameter externally while the simulation is running. I am aware that I can use SET_PARAM command in MATLAB file S-function to change the parameter value. I would like to an example demonstrating this usage.

Best Answer

You can change the value of a block paramter using SET_PARAM command in the Output function of a MATLAB file S-function. Take a look at the attached model and S-function which demonstrates changing the Initial Condition of the Rate Limiter block to the Amplitude value of the Sine Wave block.