Rosetta Code:Village Pump/BBC BASIC FFT possible error
From JohnMC. I am new to Rosetta Code, but was pleased to find an implementation of the Fast Fourier Transform FFT in many languages including BBC BASIC. I have used this. It works with the given data example, but seems to fail with other data. I made this change to 16 input points:
DIM Complex{r#, i#} DIM in{(15)} = Complex{}, out{(15)} = Complex{} REM DATA 1, 1, 1, 1, 0, 0, 0, 0
DATA 0, 0, 0, 0.2, 0.4, 0.6, 0.8, 1, 0.96, 0.84, 0.64, 0.36, 0, 0, 0, 0
PRINT "Input (real, imag):" FOR I% = 0 TO 15 READ in{(I%)}.r# PRINT in{(I%)}.r# "," in{(I%)}.i# NEXT
PROCfft(out{()}, in{()}, 0, 1, DIM(in{()},1)+1)
PRINT "Output (real, imag):" FOR I% = 0 TO 15 PRINT out{(I%)}.r# "," out{(I%)}.i# NEXT END
No other change should be needed. However the output is just a list of zeros, which is incorrect. Can anyone comment, please?
Fixed, thanks. RichardRussell (talk) 03:49, 21 April 2023 (UTC)