Dear Julians,
I observed some inconsistent behavior with the @. dot macro which drove me mad in the last hours. Please see my code below.
using FFTW
fs = 16.0
dt = 1.0/fs
N = 1024
t = 0:dt:(N-1)*dt
y = zeros(Float64, N)
@. y = 0.4 * sin(2.0 * pi * 2.0 * t)
Sx = fft(y) # FFT-spectrum of signal x
Sxx_DBL = conj.(Sx) .* Sx # results 1
@. Sxx_DBL = conj(Sx) * Sx # results 2
Please compare the lines commented with results 1 and results 2. Both should lead to identical results with complex values i.e. with a real and an imaginary part. However, results 2 occasionally lead to real part values only. But only from time to time. BTW, while trying it out at the moment I even can not reproduce the wrong behavior. But it occured several times. So that I can’t trust the @. macro at the moment. Any Ideas ?
5 posts - 3 participants