Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Matlab function 2 convert negative decimals to signed binary values

Status
Not open for further replies.

vickyuet

Member level 2
Joined
Oct 3, 2006
Messages
51
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
pakistan
Activity points
1,691
Dear All,

I need to convert signed/unsigned decimals to their equivalent signed binary values in Matlab.I had used 2 functions but they work for positive integers only i.e de2bi() and dec2bin().Is there any function that help me or I had to write my own routine for conversion.

Regards,
 

emresel

Full Member level 5
Joined
Feb 12, 2008
Messages
265
Helped
61
Reputation
122
Reaction score
61
Trophy points
1,308
Location
Turkiye
Activity points
2,842
Hi;
If you know your number of bits in binary, you can do smthng like this, (for decimal numbers smaller than zero);
Let say 4 bit binary represantation;
Then ie -3 complementary number is 2^4+(-3)=13
13 in binary form (here use dec2bin or de2bi) [1101]. If you consider this number in signed manner it corresponds to -3 (take 1's complement and add 1 **broken link removed**).

Hope helps
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top