How to set a system constant to be used in multiple blocks in Simulink

53 views (last 30 days)
I am beginner in Simulink.
I have a large system making use of same type of component models (each as user-defined Matlab function). I want to make a parametric study to evaluate the system for different parameter values at the component so I need to define the parameter values centrally. Is there a way to define the system parameters at one block (somehow it will generate the global variables) so the component model parameters will get updated automatically?

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 18 Oct 2019
The general approach is to define a parameter (e.g. MyPar1) in base workspace or in a data dictionary, then you can use this parameter for multiple blocks (for example, specify the Gain as MyPar1 or the value of a Constant block as MyPar1).
In the case of MATLAB function block, you can click "Edit Data" in the Editor and then Add Data, specify the Scope as Parameter.
  3 Comments
Fangjun Jiang
Fangjun Jiang on 18 Oct 2019
Yes. Just start withy MyPar1=1 in base workspace and then use it anywhere in your model.
Later, you can manage this in a "Simulink data dictionary".

Sign in to comment.

More Answers (0)

Categories

Find more on Interactive Model Editing in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!