MATLAB Answers

How to know the value of a variable in a past time in Simulink?

조회 수: 2(최근 30일)
Matheus Andrade
Matheus Andrade 2021년 5월 6일
편집: Matheus Andrade 2021년 5월 7일
Hello, everyone! I created a Simulink model composed of several Matlab function blocks. I need to add another one and that's why I'm asking this question.
I'm going to use this model with real time data using the real time synchronization block and the simulation time will be "inf".
This simulation will run for something around 2 hours in near real time. After the first 30 minutes I need to have the value of one of my variables from 5 minutes before to compare it to the the value that it is now in each time step.
After 30 minutes of simulation I need the value of this variable when the simulation was on its 25 minutes and so on.
How could I do it? I need some advices!
Thank you all for the help.

채택된 답변

Steven Lord
Steven Lord 2021년 5월 6일
I think you want a Unit Delay block.
  댓글 수: 1
Matheus Andrade
Matheus Andrade 2021년 5월 7일
I created a Matlab Function Block with two inputs, one passing throught the Delay block and the other coming directly from the previous block. It worked, thank you!
I'd like to find a way to create this delay without this block for aesthetic purposes since my model is composed of Matlab Function Blocks only, find a way to create this delay inside the function block, but the Delay block will do it for now.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by