Getting output data from Simulink
3 次查看(过去 30 天)
显示 更早的评论
I have a simulink model that runs for 600 time steps and I want to get the output data from the scopes. I set the scope parameters to logging to workspace but when I check my workspace, the output data only has 192 data points. How do I get the values for each time step (getting 600 data points where each point corresponds to a time step).
7 个评论
Fangjun Jiang
2020-11-30
No need to provide wild guesses like "extra data points are getting truncated" or "it seems it increases by 12 each time". You expect to see 600 data points based on your understanding (which is incorrect). You received 192 data points in one case and 292 data points in another case. This can be explained by the fact that you are using variable time step solver.
You can learn about variable time step solver by right click at "Solver" and select "What's this".
Other than that, there is really no problem. If your simulation results are correct, they are correct.
回答(1 个)
Fangjun Jiang
2020-12-1
The different size of the logged data is caused by the variable-step solver. To get a consistent and fixed size log data, use a fixed-step sover.
1 个评论
jessupj
2020-12-1
i agree: using a fixed timestep solver is the solution here to the OP's problem as stated.
however, it depends on the system. sometimes it's better to interpolate the output of variable timestep solvers to the time points you want; fixed timesteps can be extremely inefficient and/or won't work for stiff problems.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!