how can I get binary output '0'or '1' according to sign of the input value ?
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sarfaraz Ahmed
il 24 Ott 2018
Modificato: Sarfaraz Ahmed
il 25 Ott 2018
Hi. I have output of ADC which give sampled value either negative or positive. I want to decode these values in binary form '1' or '0'. let say if positive value appear, the logic should show '1' otherwise '0'. it means it should be sign-based detection. this logic I need at the end of the system (difference block in attached file). is there any block in simulink or can I make customized code in MATLAB function block ? It would be appreciated if someone can help in this regard.
Thanks in Advance
2 Commenti
Risposta accettata
Ghetto blaster
il 24 Ott 2018
Actually what you would want is step function. heaviside() is most optimal except I assume that you want for the input value of 0 for output to also be 0? In that case you would need to set the HeavisideAtOrigin to be 0. Also I assume you want output to be logical or floating point? heaviside outputs floating.
oldparam = sympref('HeavisideAtOrigin',0);
output_logical = heaviside(input_voltage);
5 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Simulink Functions in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!