How to export plots from different simulink projects with the same time format?

4 次查看(过去 30 天)
I am trying to export data from scopes of different simulink projects. One group of data gives me 40 seconds in 156 rows of data, meanwhile the other group from a different project gives me 40 seconds in 2000+ rows of data. Is there any way to tell simulink to give me an exact amount of data for 40 seconds? So every project gives me the same amount of information in 40 seconds.

回答(1 个)

Nihal
Nihal 2024-9-16,8:11
Hi,
I understand that you want to generate same size output in a given amount of time from different Simulink models.
In Simulink, the number of rows of data generated by a scope depends on the simulation time step and the sample time of the signals being logged. If you want to ensure that you obtain the same amount of data for a fixed duration (e.g., 40 seconds) across different Simulink projects, you can adjust the simulation settings to achieve consistent data output.
Here are a few approaches that you can try:
  1. Adjust the simulation time step: By reducing the simulation time step, you can increase the number of data points generated within a fixed duration. In the Simulink model, go to the Configuration Parameters dialog, navigate to the Solver pane, and decrease the Fixed-step size or Solver step size settings. This will result in a finer time resolution and more data points within the same time duration.
  2. Modify the sample time of signals: If the sample time of the signals being logged is different between the projects, it can affect the number of data points generated. Ensure that the sample time of the signals is the same or adjusted accordingly to obtain consistent data. You can modify the sample time by selecting the signal line and adjusting the Sample time property in the Signal Properties dialog.
  3. Use a fixed-step solver: If your Simulink models use variable-step solvers, switching to a fixed-step solver can provide more control over the number of data points generated. In the Configuration Parameters dialog, select a fixed-step solver under the Solver pane. This will ensure a constant time step throughout the simulation and produce a consistent number of data points.
By adjusting the simulation time step, modifying the sample time of signals, or using a fixed-step solver, you can control the number of data points generated within a fixed duration in different Simulink projects. Experiment with these settings to achieve the desired consistency in data output.
For more information refer to documentation linked below.

类别

Help CenterFile Exchange 中查找有关 Large-Scale Modeling 的更多信息

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by