Outputing a high and low value based on a negative or positive signal

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?

답변 (2개)

Matt Kindig
Matt Kindig 2012년 10월 19일
편집: Matt Kindig 2012년 10월 19일

0 개 추천

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.
Azzi Abdelmalek
Azzi Abdelmalek 2012년 10월 20일
편집: Azzi Abdelmalek 2012년 10월 20일

0 개 추천

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

Won't the output of the sign block be -1 if u<0?
Azzi Abdelmalek
Azzi Abdelmalek 2012년 10월 23일
편집: Azzi Abdelmalek 2012년 10월 23일
you are right Matt. we can add 1 and a 0.5 gain block
but your suggestion (compare to cst) is better

댓글을 달려면 로그인하십시오.

카테고리

제품

질문:

2012년 10월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by