| New Reply |
Can someone briefly explain fixed-point? MATLAB |
Share Thread | Thread Tools |
| Jun9-12, 10:54 AM | #1 |
|
|
Can someone briefly explain fixed-point? MATLAB
Hi, I've been through the help files and demos but one question which I can't find the answer to is destroying my confidence with this toolbox.
If I write: a = fi(3336770033), why does it write 3336830976? I can't figure out why it's losing my number. I don't need any moving decimals, all I want to do is multiply this number a few times, and get the result with complete accuracy. 64 bits is not enough so floating point won't do. Am I using the wrong toolbox for this purpose? Thanks |
| Jun9-12, 11:54 AM | #2 |
|
Recognitions:
|
Hi MikeyW!
![]() What you have is 32 bits floating point precision (about 6 significant digits). Since the default of matlab is 64 bits precision, someone must have forced it down somewhere. How is fi() defined? Does it perhaps have a "single" precision floating point argument instead of a "double" precision argument? |
| Jun9-12, 03:25 PM | #3 |
|
|
According to the documentation, the default word size for the fixed point function fi is 16 bits.
If you want to multiply large numbers and retain full significance then you need the Symbolic Toolbox. I believe Matlab uses MuPad as the engine for its Symbolic Toolbox, which is the same as Mathcad ... I've attached a screenshot from Mathcad - is this what you want to do? |
| Jun9-12, 03:34 PM | #4 |
|
Recognitions:
|
Can someone briefly explain fixed-point? MATLAB
Sorry, I was not familiar with the fi() function yet.
From its description: "fi(v) returns a signed fixed-point object with value v, 16-bit word length, and best-precision fraction length." It seems to me that 16-bit word length implies at most 5 significant digits. If you want more significant digits, you should not use this fi() function. As you can see in your own screenshot, if you don't tell Matlab what to do with the representation of the numbers, it does just fine, showing as many accurate digits as you want. |
| Jun10-12, 05:49 PM | #5 |
|
|
|
| Jun11-12, 07:27 AM | #6 |
|
|
Hmm, ok, thanks. I'm still not sure why fi(x) doesn't just give x, it's not like it can be limited by the bit size since the (incorrect) 3336830976 is the same length as my input 3336770033.
I'll give the symbolic toolbox a go, thanks. |
| Jun11-12, 07:42 AM | #7 |
|
|
|
| New Reply |
| Thread Tools | |
Similar Threads for: Can someone briefly explain fixed-point? MATLAB
|
||||
| Thread | Forum | Replies | ||
| explain, briefly, what a hysteresis cycle is | Introductory Physics Homework | 1 | ||
| Please Explain this reation to me.. Very Briefly | Chemistry | 8 | ||
| MATLAB:Please Help with My Fixed Point Iteration Program | Engineering, Comp Sci, & Technology Homework | 1 | ||
| Fixed Point iteration using matlab, whats wrong with my code?? | Engineering, Comp Sci, & Technology Homework | 2 | ||
| fixed point iteration question with matlab | Engineering, Comp Sci, & Technology Homework | 0 | ||