Clear Filters
Clear Filters

How can I create condition with changement of states on Simulink ?

1 view (last 30 days)
Hello everyone !
I have some trouble to modelize a condition on Simulink, the condition is : if the button is On (value = 1) then Off (Value goes back to 0) then all the devices (lamp, audio signal...) are disabled. In order to modelize my model I have created a Chart diagram (Stateflow) with all of the outputs of my model and I have created Simulink fonctions for the transitions between the states.
In order to modelize the condition I tried the block "Detect Decrease" this block allows to output TRUE if the input is strictly less than its previous value but it doesn't work.
If you have other ideas to modelize this condition in simulink please let me know.
Thank you !
Eloise Paper

Answers (1)

Sai Teja Paidimarri
Sai Teja Paidimarri on 18 Jun 2020
hi Eloise paper,
if you wanted to change states along with the on and off button without detect decrease.you can follow these steps.
1.you can use single on and off button compared with constant using equal operator will give you 1 if button is on,0 if button is off.
2.route this single value and add to n different constants say 1+1 , 1+2 ,1+3 .. for which you get 2,3,4...
3.use direct table to create a logic you need just like demux connect it to output devices using conditional operator >=

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!