[Scilab-users] Is this behavior of ifft / isreal correct?

Federico Miyara fmiyara at fceia.unr.edu.ar
Thu Apr 7 05:24:47 CEST 2022


Dear all,

Consider

M = 16
w = [ones(1,M/4),zeros(1,M/4)]
w = [w(1:M/2), 0, conj(w($:-1:2))]
v = ifft(w)
isreal(v)

The first 3 lines defines a real spectrum of a real signal, then the 
real signal is recovered and finally it is checked whether it is real or 
not.

What puzzles me is that the result is T (true). However, the definition 
of the ifft() involves complex operations, so at some point the numbers 
must be converted to a complex representation such as

1. + 0.i

so I would expect that the result included 0i so the result of the test 
should be F. Where is this null imaginary component removed?

I don't say this is wrong, but it is perplexing if compared to much more 
simple operations such as

sqrt(%i^4)

which yields 1. + 0.i, a complex representation of real scalar 1.

Maybe the fftw package is so refined to detect whether the result is 
actually real and removes the useless 0.i components?

Regards,

Federico Miyara




-- 
El software de antivirus Avast ha analizado este correo electrónico en busca de virus.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20220407/f35cf920/attachment.htm>


More information about the users mailing list