| Contents | Index |
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.
Value |
Value of the simulation parameter. Get the value of the simulation parameter StopTime by entering: configSetParamValue = get_param(configSet, 'StopTime') |
ParameterStruct |
A structure containing parameter settings |
ConfigSet |
A configuration set |
simOut |
Simulink.SimulationOutput object containing 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.
In the case of a model with a Model block, the parameter specifications are applied to the top model.
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)
Backwards Compatible Syntax | parfor | Rapid Accelerator Simulations Using PARFOR | sldebug

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