Thanks for your answer Akshata. I tried your solution, but "symbol wizard" window is opened and ask to give a role(input, constant, parameter,...) to the name of gain block. And, all of these options cause another error.
How I can define a varying parameter in Simulink Test?
68 views (last 30 days)
Show older comments
Hi,
I am designing a Test Harness for my model. I have a parameter in the simulink model(a gain) and I want to develop a test sequence to test the sensitivity of my model with respect to this parameter. simply, I want to design a DOE for my model. I defined the parameter in the test sequence and I define that in the Model Explorer, too. But, I received the below error. Could you please guide me that how I can define a parameter that I can change in each test by Test Sequence Editor block?
Thanks for your consideration and time.
regards, --------- "Constant or Parameter data 'AAA' on left hand side of an expression.
State 'step_2' "AAA" ----------
Answers (2)
Sarah Dagen
on 10 Jun 2019
To change this gain value from a test sequence block, you need to follow a pattern such as in the image below:

You need to declare evalin, set_param, and num2str as coder.extrinsic in the initialization step of the test sequence. You can then use these commands in sequence steps to change the gain value in the base workspace during simulation.
1 Comment
Remy MARCEL
on 22 Mar 2021
Hello, is it possible to modify a parameter that is defined into a dictionary instead of the base workspace ?
Chandrasekhar
on 15 Feb 2016
i guess you want to change the gain value while the simulink model is running. you can do that by giving the below command in your test sequence
set_param(<gain block name>,'Gain',<value>)
3 Comments
See Also
Categories
Find more on Inputs 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!