Intro Matlab Q, floating point system

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
13 replies · 3K views
Laura1321412
Messages
23
Reaction score
0

Homework Statement



So this should probably be easy, but for some reason I just can't seem to understand matlab, AT ALL. Anywho,

Consider a normalized floating point number system with b=2 p=3 L=-2 and U=2 , plot all the numbers in this system in a horizontal line, and observe... lalala

Homework Equations





The Attempt at a Solution



I can't not figure out how plot the system! I can't figure out how to enter the system! I undestant floating point numbers, but i just need a hint or two to get started at this question. thankss
 
Physics news on Phys.org
I can't elimate matlab, i am required to use matlab.

b= base = 2, p = precision L and U are the boundaries of value exponent

L<E<U

and the overall equations is

x= +/- (a0 + a1/b + a2/b^2)*b^E

So i need to find all the x for the given equation. But do it using matlab...
 
All told, there are only 80 numbers. Do you know how to find them?

Once you have them, I think that plotting them means drawing a symbol for each of them on the number line.
 
I need to find them using a function i belive... but i can't determine that function i always get matrix errors...
 
Forget MATLAB for the time being. Can you list the 80 numbers I referred to on a piece of paper? I'm trying to figure out how much of this problem you understand.
 
Laura1321412 said:
I can't elimate matlab, i am required to use matlab.

b= base = 2, p = precision L and U are the boundaries of value exponent

L<E<U

I'm pretty sure that should be [itex]L \le E \le U[/itex]

and the overall equations is

x= +/- (a0 + a1/b + a2/b^2)*b^E

I thought "normalized" floating point numbers all used an implied "1" (binary, b-1 in general) as the most significant bit of the mantissa.

So shouldn't that be more like ([b-1] + a0/b + a1/b^2 + a2/b^3)*b^EBTW. Does "p" include the implied mantissa digit or not? I mean are there three mantissa digits plus one implied, or is it two plus one implied? (I'm not sure about this).
 
Last edited:
Hi, yes, i understand the question pretty well i think

I know that the aj will be 0 or 1, and I thought binary then indicated that, Ao = 1?

So wouldn't it be x= +/- ( 1 + A1 / 2 + A2 /4 ) 2 ^ E ?

wouldn't that mean there would be 2*2*2*5 = 40 solns?

Additionally, I think I can solve for the values of X, one at a time, but in MATLAB I was trying do it using matricies... ie )

z [ -1, 1 ]
A1 [ 0,1]
A2 [ 0, 1]
E [ -2, 1,0,1,2,]

and so on. But i think its pretty clear that this won't work, since i need a way to have it work out all the options... Do i need to make more elaborate matricies? Is there a way to do this simply?

Sorry for the lack of elaboration in the OP
 
I think you need to get some clarification on this problem from your instructor, about whether the first digit (to the left of the "binary" point) is an implied 1. If so, then each mantissa would look like
[itex]\pm 1.a_0a_1a_2 \cdot 2^E[/itex]

If this is what they look like, then there will be 2 * 8 * 5 numbers in all, because of 8 possibilities of the three binary digits, 5 choices for the exponent, and doubling these because of the sign. That makes 80 numbers in all.

In any case, you can use MATLAB to fill up a single, one-dimension array with all of the numbers.

Next, you need to get clarification on what it means to graph them. My earlier thought was that you could display them all (using, say, an * character) at the right location on an appropriate section of the number line. Does the problem statement give any more guidance on what is needed here? If not, check with your instructor.
 
why can't i use something like this on matlab?

for a=0:1
for c=0:1
for w=-1:1
for E=-2:2
x=w.*(1+ (a/2)+(c/4)).*2.^E
end