Prev: Daubechies wavelet - scaling and wavelet function in MATLAB
Next: Newbie question on SIMULINK/RTW input strategy
From: ANITHA SHUKLA on 30 Apr 2010 12:07 Hello everyone, am looking for the matlab code for converting NEGATIVE FRACTIONS TO BINARY. example fractions like------ - 0.432937622070313, -0.131301879882813, -0.312225341796875. so could any one plz help me out how to convert from negative fractions to binary.
From: James Tursa on 30 Apr 2010 16:41 "ANITHA SHUKLA" <shuklapatela(a)gmail.com> wrote in message <hrev78$qop$1(a)fred.mathworks.com>... > Hello everyone, > > > am looking for the matlab code for converting NEGATIVE FRACTIONS TO BINARY. > > example fractions like------ > - 0.432937622070313, -0.131301879882813, -0.312225341796875. > > so could any one plz help me out how to convert from negative fractions to binary. Convert them to binary *what*? They are already in memory in binary floating point format, so what do you mean by binary? James Tursa
From: Walter Roberson on 30 Apr 2010 23:35 ANITHA SHUKLA wrote: > Hello everyone, > > am looking for the matlab code for converting NEGATIVE FRACTIONS TO BINARY. > > example fractions like------ - 0.432937622070313, > -0.131301879882813, -0.312225341796875. > > so could any one plz help me out how to convert from > negative fractions to binary. The following will get you part-way there, but you need to be clear about _which_ binary representation you want for your negative values. Standard IEEE floating point representation uses the leading bit to indicate whether the number as a whole is negative or not. But if all you want is IEEE floating point representation, then you can use num2hex() and then do a simple table lookup to convert each nibble to binary. http://groups.google.ca/group/comp.soft-sys.matlab/browse_thread/thread/80e519cbfc3b4a26/42663465ad67387d
From: ANITHA SHUKLA on 5 May 2010 17:30 "ANITHA SHUKLA" <shuklapatela(a)gmail.com> wrote in message <hrev78$qop$1(a)fred.mathworks.com>... > Hello everyone, > > > am looking for the matlab code for converting NEGATIVE FRACTIONS TO BINARY. > > example fractions like------ > - 0.432937622070313, -0.131301879882813, -0.312225341796875. > > so could any one plz help me out how to convert from negative fractions to binary. IN FIXED-POINT FORM THE MAIN PROBLEM IS I NEED TO GENERATE THE RECEIVED SIGNAL STRENGTH(RSSI) OF 16-BIT IN FIXED POINT. FOR SUPPOSE IF I GOT ADC VALUES BETWEEN -32768 TO +32767, ASSUME LIKE -29312, -4565, 65433, 12345, -12343 THEN PLZ TELL ME HOW TO GET RSSI USING FIXED POINT ALGORITHM IN MATLAB
From: James Tursa on 5 May 2010 19:19
"ANITHA SHUKLA" <shuklapatela(a)gmail.com> wrote in message <hrso0v$cp3$1(a)fred.mathworks.com>... > "ANITHA SHUKLA" <shuklapatela(a)gmail.com> wrote in message <hrev78$qop$1(a)fred.mathworks.com>... > > Hello everyone, > > > > > > am looking for the matlab code for converting NEGATIVE FRACTIONS TO BINARY. > > > > example fractions like------ > > - 0.432937622070313, -0.131301879882813, -0.312225341796875. > > > > so could any one plz help me out how to convert from negative fractions to binary. > > IN FIXED-POINT FORM > THE MAIN PROBLEM IS I NEED TO GENERATE THE RECEIVED SIGNAL STRENGTH(RSSI) OF 16-BIT IN FIXED POINT. > > FOR SUPPOSE IF I GOT ADC VALUES BETWEEN -32768 TO +32767, ASSUME LIKE > -29312, -4565, 65433, 12345, -12343 > THEN PLZ TELL ME HOW TO GET RSSI USING FIXED POINT ALGORITHM IN MATLAB Please give a specific example of inputs and outputs of what you would like. James Tursa |