Question
I am using the Simulink.SimulationInput class to define simulation parameters for multiple simulations. I am using the following lines of code: simIn = Simulink.SimulationInput(model); simIn.setModelParameter('SaveTime','on','TimeSaveName','tout'); simIn.setModelParameter('SaveState','on','StateSaveName','xout'); simIn.setModelParameter('SaveOutput','on','OutputSaveName','yout'); simIn.setBlockParameter('model/Proportional Gain', 'Value', '-9.4'); simOut = sim(simIn); I can tell that none of these parameters are changed when I simulate the model. I expect that the gain value of -9.4 will cause the system to become unstable. However, the plot of the system response is exactly the same as that of the default model. What step am I missing to be able to use the 'SimulationInput' object for running multiple simulations?
Expert Answer
Neeta Dsouza
PhD Expert
Answered Aug 17, 2026
The SimulationInput object methods must be reassigned to the object itself after being called e.g. 'simIn =' should appear on the left-hand side of the call to 'simIn.setModelParameter' as in this documentation page:
Otherwise, the resulting SimulationInput object will be returned to 'ans' in the workspace and executing the 'sim' command on the originally created object will run the model without any changes.
The correct way to use the methods for the SimulationInput object for your example is shown below:
simIn = Simulink.SimulationInput(model);
simIn = simIn.setModelParameter('SaveTime','on','TimeSaveName','tout');
simIn = simIn.setModelParameter('SaveState','on','StateSaveName','xout');
simIn = simIn.setModelParameter('SaveOutput','on','OutputSaveName','yout');
simIn = simIn.setBlockParameter('model/Proportional Gain', 'Value', '-9.4');
simOut = sim(simIn);
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related model Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →