results with strange floating-point number bias
[email protected] Wed, 6 Aug 2003 11:22:22 -0300
| Newsgroups | gmane.comp.gnu.octave.sources |
|---|---|
| Message-ID | <[email protected]> |
Hello
I'm trying to implement a FFT function with the new fftw3 library. I'm
creating a rfft fucntion first, using fftw's special real-signal
function first.
I got the function running well, but there is the strangest thing
happening. The result it returns is summed by a large number
(455103.06358 once, but it changes).
And it's only for real numbers! The imaginary part is OK
I bet it has something to do with the way octave stores the numbers, but
as I have not messed with octave's code enough, I'm looking for
advices..
It REALLY looks like it's mixing a pointer value with the numerical
value of the real part... But what is strange is that I could extract the
correct values once, doing a subtraction.
any ideas?
Here is a sample of what is happening:
oct:50> fft([1 0.5 0.3 -1]')
ans =
0.80000 + 0.00000i
0.70000 - 1.50000i
1.80000 + 0.00000i
0.70000 + 1.50000i
oct:51> fftnic([1 0.5 0.3 -1]')
ans =
4.5509e+05 + 0.0000e+00i
4.5509e+05 - 1.5000e+00i
4.5509e+05 + 0.0000e+00i
oct:68> fftnic([1 0.5 0.3 -1]') - 455097
ans =
-5.1915 + 0.0000i
-5.2915 - 1.5000i
-4.1915 + 0.0000i
oct:70> fftnic([1 0.5 0.3 -1]') - 455097
ans =
6.8636 + 0.0000i
6.7636 - 1.5000i
7.8636 + 0.0000i
See, there is a constant added, the right result is there too!!
--
Nicolau Werneck <[email protected]> 9F99 25AB E47E 8724 2F71
http://cefala.org/~nwerneck EA40 DC23 42CE 6B76 B07F
"After silence, that which comes nearest to expressing the inexpressible is music."
-- Aldous Huxley