Reputation: 531
I have created the following block diagram on Matlab Simulink. It should give OUT1=1 OUT2=0 when INPUT>=0 and OUT1=0 OUT2=1 when INPUT<0. But it does not give the expected results. What is the reason for that. Any advice to make it work correctly would be appreciated.
Upvotes: 0
Views: 4814
Reputation: 10762
The behaviour you are seeing can be explained by noting the following:
This can be changed by going to the parameters dialog of the Output Port (within the If Action Subsystems) and changing the Output when disabled property to reset. You'll also want to change the default value to zero.
Upvotes: 3
Reputation: 36710
In many cases an IF is translated to a switch. You calculate cases and select the one which is intended. Here you could connect a constant [1 0] and a constant [0 1] to the first and third input and the sign block from your solution to the second input.
Upvotes: 1
Reputation: 531
This if function block thing didn't work. So I come up with a different approach to get the result I wanted using the sign block. Solution is posted below. Thank you for everyone for trying to help.
Upvotes: 0