필터 지우기
필터 지우기

Creater a vector front a signal data in specific time intervals

조회 수: 1 (최근 30일)
viyils Sangregorio
viyils Sangregorio 2021년 10월 26일
답변: Samay Sagar 2024년 3월 1일
I have a equations systems in simulink, that give the direfential equations solutions
In specific times of simulation, for example at 10, 20, 30.. [x1 x2 x3] until the 1000000 and thus,
I need one of these signals in a vector that I can access to compute the diference beetwem samples during the entirely simulation.
For example at 20 seconds i need to know what is x2-x1..
thanks guys,,,,

답변 (1개)

Samay Sagar
Samay Sagar 2024년 3월 1일
In Simulink, the "To Workspace" block offers a convenient way to export the output of your simulation directly to the MATLAB workspace. Subsequently, you can use the output in the workspace to access values of signals at specific timestamps for further computation.
Here is a step-by-step guide to achieve this:
  • Add a "To Workspace" block for each signal you want to save (x1, x2, x3, etc.) and connect it to its respective signal.
  • Configure the "To Workspace" block to have a desired variable name (like x1, x2, x3, etc.) and set the sample time (e.g., 10 for sampling every 10 seconds).
  • The default output type of "To Workspace" block is "Timeseries". You can change it to "Array" for ease of use. After running the simulation, you can access the data as "out.x1" and use it for further computation. Assuming that the sample time for the signals is 10 s, you can access the data at time 20 s as "out.x1(3)".
You can read more about the "To Workspace" block here:

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by