The RS FlipFlop in the Simulink library is not working properly.
4 views (last 30 days)
Show older comments
Hello, The RS FlipFlop in the Simulink library is not working correctly, because when I set the input S = 1 and R = 1, the output Q = 1, but after that when I set S = 0 and R = 0 it does not remember the previous state, instead Q is equal to the value of the initial conditional RS setting. The correct is tha de flip flop RS remember the beofre state when R=0 anda S=0.The correct thing is that the RS flip-flop remembers the previous state when R=0 and S=0.
0 Comments
Answers (1)
Fangjun Jiang
on 7 Jan 2026
Double click the block, click "Help" to bring up the document.
It says when S=1 and R=1, both Q=0 and !Q=0, and this should be avoided.
4 Comments
Fangjun Jiang
on 10 Jan 2026
Edited: Fangjun Jiang
on 10 Jan 2026
Your model did not show the problem.
The RS FlipFlop block did not have any problem.
Your input value for both the R and S are always 0 so the output Q should be Q(n-1).
If you double click the block and set the "Initial condition for Q state", which means Q(n-1) for your model, to be 1 or 0, then the simulation result keeps that value. This indicates the correct behavior.
Somehow, you must understand something wrong. The attached model should convince you.
By the way, the FlipFlop block you mentioned is from SimScape. It can specify whether "Set" or "Reset" has the priority. It does not have the problem when both R=1 and S=1, which applies to the generic Simulink Extras/Flip Flops/S-R Flip-Flop block.
See Also
Categories
Find more on General Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!