I'm little stuck here. The results of Forward Fourier by MathNet Numerics seem to be little less by half of those by MATLAB.
MathNet.Numerics on WindowsPhone 8
Complex[] samples = { new Complex(5, 0), new Complex(6, 0), new Complex(1, 0), new Complex(2, 0), new Complex(5, 0) };
MathNet.Numerics.IntegralTransforms.Transform.FourierForward(samples);
MathNet.Numerics.IntegralTransforms.Transform.FourierInverse(samples);
Original Signal
(5, 0) (6, 0) (1, 0) (2, 0) (5, 0)
Forward Fourier
(8.4970583144992, 4.96506830649455E-16) (2.67082039324994, -0.162459848116454) (-1.32917960675006, -0.688190960235587) (-1.32917960675006, 0.688190960235586) (2.67082039324994, 0.162459848116454)
Inverse Fourier
(5, -1.24126707662364E-15) (6, 0) (1, 1.78742459033804E-15) (2, 9.93013661298909E-16) (5, 7.94410929039127E-16)
Matlab FFT and IFFT
Original Signal
x=[5,6,1,2,5]
Forward Fourier fft(x)
ans = 19.0000 5.9721 - 0.3633i -2.9721 - 1.5388i -2.9721 + 1.5388i 5.9721 + 0.3633i
Inverse Fourier ifft(ans)
5.0000 6.0000 1.0000 2.0000 5.0000
Any ideas what I'm doing wrong here?
There are multiple FFT conventions around scaling and exponents. The default convention used by Math.NET Numerics is what is generally used in science and education (and also e.g. in Maple) with symmetric scaling. However, MATLAB uses asymmetric scaling. In order to get MATLAB's behavior and numeric results, add FourierOptions.Matlab
as second parameter, i.e.
Transform.FourierForward(samples, FourierOptions.Matlab);
Transform.FourierInverse(samples, FourierOptions.Matlab);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With