Simulink configuration to save/plot data

8 次查看(过去 30 天)
Why does my simulink scope plots data i did not ask for it? Did i mess up some configuration? I don't remember changing anything, but this is the plot i'm getting
this also makes the data i want to save incorrect using To Workspace. Does anyone know what's going on? Thank u so much!
  2 个评论
Aquatris
Aquatris 2024-6-21
what is in the first transfer function and whta is in the second transfer function?
Looks like they are not a single transfer functions but a matrix of transfer functions. You should provide the full file for someone to be more helpful
Francisco J. Triveno Vargas
Hi JB,
  • Initially you can go to configurations and use a fixed step, for example 1/200, also use the runge-kutta algorithm
  • Second, you can use the configurations to save the variables that you want from your sctructure
  • Third, you can use to workspace block, record and save, after that you need to creiate a small script to plot the variables that you needed.
Regards

请先登录,再进行评论。

回答(1 个)

Anushka
Anushka 2025-6-16
Hi @JB,
According to my understanding, the issue you are facing is likely because you are feeding a 'Mux' block (which combines multiple signals) into both the 'Scope' and the 'To Workspace' block. When you do this, Simulink logs all the signals in the 'Mux', not just the one you are interested in. This is why you are seeing unexpected plots and incorrect data being saved.
To fix this, use separate lines to tap only the specific signal(s) you want and connect them individually to their own 'To Workspace' blocks. This will ensure only the relevant data is logged and plotted. You can still use the 'Mux' for visualization in the 'Scope' if needed but keep logging separate for clean results. You can do the same by following the below given steps:
  1. Tap off the lines for the signals you need: e.g., just y(t) or u(t).
  2. Add a separate 'To Workspace' block for each signal.
  3. Set the Save format to 'Array' or 'Structure with time' depending on your need.
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 View and Analyze Simulation Results 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by