필터 지우기
필터 지우기

How to determine previous input in MATLAB Function block in Simulink?

조회 수: 5 (최근 30일)
Bhargava Reddy Banala
Bhargava Reddy Banala 2017년 12월 3일
댓글: Bhargava Reddy Banala 2017년 12월 3일
I am trying to simulate Miller-L code in simulink using MATLAB Function block. The input is a Random Integer generator generating binary input 0 and 1 at a rate of 1 KHz. I want to code so that
if Previous_bit == 1
no change in output
else
change output state
end
Hoe can I do this? I tried using loops but didn't work.

답변 (1개)

Walter Roberson
Walter Roberson 2017년 12월 3일
You cannot determine the previous input.
If you are using a MATLAB Function block, you could use "persistent" to remember the previous input. If you are using a Level 2 Function then you could use a dwork vector to remember the previous input.
But remember that the previous input might be for a time after the current time.
Consider using a Memory Block, or a First Order Hold, or a Transfer Function, or a Flip Flop.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by