Is it possible to use previous time step when I use Clock Block in simulink.

In my model I have to use 2 values of time in every moment of simulation. For example I have time steps returned by Clock Block : [1 2 3 4 5 6 7 8 9 10 ...] and I need to use in my function 2 values: previous and current steps. It looks like MyFunc[0 , 1], MyFunc[1 , 2], MyFunc[2 , 3] until the end of simulation. Is it possible using only Clock Block, or there are some other ways to solve this problem?

답변 (1개)

Les Beckham
Les Beckham 2015년 11월 18일
Try feeding the clock output through a unit delay block to get the time at the previous simulation step. You should also set your model to use a fixed step solver.

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

제품

태그

질문:

2015년 11월 11일

답변:

2015년 11월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by