How to determine previous input in MATLAB Function block in Simulink?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Bhargava Reddy Banala
el 3 de Dic. de 2017
Comentada: Bhargava Reddy Banala
el 3 de Dic. de 2017
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.
0 comentarios
Respuestas (1)
Walter Roberson
el 3 de Dic. de 2017
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.
Ver también
Categorías
Más información sobre Sources en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!