| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
simOut = sim('model',
'ParameterName1',Value1,'ParameterName2', Value2...);
simOut = sim('model', ParameterStruct);
simOut = sim('model', ConfigSet);
simOut = sim('model', 'ParameterName1',Value1,'ParameterName2', Value2...); causes Simulink software to simulate the block diagram, model, using parameter name-value pairs ParameterName1, Value1 and ParameterName2, Value2.
simOut = sim('model', ParameterStruct); causes Simulink software to simulate the block diagram, model, using the parameter values specified in the structure ParameterStruct.
simOut = sim('model', ConfigSet); causes Simulink software to simulate the block diagram, model, using the configuration settings specified in the model configuration set, ConfigSet.
ParameterNamek |
The name of a parameter to be specified for simulation. |
Valuek |
The value of the parameter, ParameterNamek (Value1 is the value of ParameterName1.) |
ParameterStruct |
A structure containing parameter settings |
ConfigSet |
A configuration set |
simOut |
A Simulink.SimulationOutput object that contains all of the simulation outputs—logged time, states, and signals |
For all three formats of the sim command, the input(s) are parameter specifications that override those defined on the Configuration Parameters dialog box. The software restores the original configuration values at the end of simulation. For additional details about the sim command, see Using the sim Command.
Simulate the model, vdp, in Rapid Accelerator mode for an absolute tolerance of 1e-5 and save the states in xoutNew and the output in youtNew.
Specify parameter name-value pairs within the sim command:
simOut = sim('vdp','SimulationMode','rapid','AbsTol','1e-5',...
'SaveState','on','StateSaveName','xoutNew',...
'SaveOutput','on','OutputSaveName','youtNew');Specify parameter values in a structure, paramNameValStruct:
paramNameValStruct.SimulationMode = 'rapid';
paramNameValStruct.AbsTol = '1e-5';
paramNameValStruct.SaveState = 'on';
paramNameValStruct.StateSaveName = 'xoutNew';
paramNameValStruct.SaveOutput = 'on';
paramNameValStruct.OutputSaveName = 'youtNew';
simOut = sim('vdp',paramNameValStruct);Specify a configuration set containing the parameter values:
mdl = 'vdp';
load_system(mdl)
simMode = get_param(mdl, 'SimulationMode');
set_param(mdl, 'SimulationMode', 'rapid')
cs = getActiveConfigSet(mdl);
mdl_cs = cs.copy;
set_param(mdl_cs,'AbsTol','1e-5',...
'SaveState','on','StateSaveName','xoutNew',...
'SaveOutput','on','OutputSaveName','youtNew')
simOut = sim(mdl, mdl_cs);
set_param(mdl, 'SimulationMode', simMode)parfor | Rapid Accelerator Simulations Using PARFOR | sldebug
![]() | signalbuilder | simplot | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |