MATLAB中simout怎么⽤,以编程⽅式运⾏仿真此⽰例对采⽤名称-值对组形式指定参数值的模型进⾏仿真。运⾏仿真。 simOut = sim('vdp','SimulationMode','normal','AbsTol','1e-5',...
'SaveState','on','StateSaveName','xoutNew',...
'SaveOutput','on','OutputSaveName','youtNew',...
'SaveFormat', 'StructureWithTime');
访问 ModelInfo 属性,其中包含有关模型和求解器的基本信息。
maxstepans =
struct with fields:
ModelName: 'vdp'
ModelVersion: '1.6'
ModelFilePath: 'C:\MyWork'
UserID: 'User'
MachineName: 'MyMachine'
Platform: 'PCWIN64'
ModelStructuralChecksum: [4×1 uint32]
SimulationMode: 'normal'
StartTime: 0
StopTime: 20
SolverInfo: [1×1 struct]
SimulinkVersion: [1×1 struct]
LoggingInfo: [1×1 struct]
检查求解器信息。
ans =
struct with fields:
Type: 'Variable-Step'
Solver: 'ode45'
MaxStepSize: 0.4000
查看仿真的时间信息,例如仿真的开始时间和完成时间,以及仿真初始化、执⾏和终⽌所⽤的时间。
ans =
struct with fields:
WallClockTimestampStart: '2016-06-17 10:26:58.433686' WallClockTimestampStop: '2016-06-17 10:26:58.620687' InitializationElapsedWallTime: 0.1830 ExecutionElapsedWallTime: 1.0000e-03 TerminationElapsedWallTime: 0.0030
TotalElapsedWallTime: 0.1870
为仿真添加说明。
simOut=simOut.setUserString('Results from simulation 1 of 10'); SimulationMetadata
ans =
SimulationMetadata with properties:
ModelInfo: [1×1 struct]
TimingInfo: [1×1 struct]
ExecutionInfo: [1×1 struct]
UserString: 'Results from simulation 1 of 10'
UserData: []
您还可以使⽤ UserData 属性添加您⾃⼰的⾃定义数据。