Outputing a high and low value based on a negative or positive signal
Mostrar comentarios más antiguos
I am using Simulink for DC motor control. My motor driver requires a direction input (high or low voltage) corresponding to the direction. Is there a way in simulink that I can get a block to output a 0 or 1 signal based upon whether the input signal has a negative or positive value?
Respuestas (2)
Matt Kindig
el 19 de Oct. de 2012
Editada: Matt Kindig
el 19 de Oct. de 2012
0 votos
Hi Joseph,
You could use a switch block ( http://www.mathworks.com/help/simulink/slref/switch.html) where the second input is your input signal (with a set threshold of 0) and the first and third inputs are 1 and 0, respectively.
1 comentario
Matt Kindig
el 19 de Oct. de 2012
Or even better, just use a Compare to Constant block ( http://www.mathworks.com/help/simulink/slref/comparetoconstant.html), which will output a 0 or 1 directly.
Azzi Abdelmalek
el 20 de Oct. de 2012
Editada: Azzi Abdelmalek
el 20 de Oct. de 2012
0 votos
Use a sign block from simulink/Math Operations . Pass your signal through sign block . the output will be 0 if u<0 and 1 if u>0
2 comentarios
Matt Kindig
el 22 de Oct. de 2012
Won't the output of the sign block be -1 if u<0?
Azzi Abdelmalek
el 23 de Oct. de 2012
Editada: Azzi Abdelmalek
el 23 de Oct. de 2012
you are right Matt. we can add 1 and a 0.5 gain block

but your suggestion (compare to cst) is better
Categorías
Más información sobre Motor Drives en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!