Getting different output for fft function in julia and matlab

You can just give fft the dimensions:

help?> fft

  fft(A [, dims])                                                                                                                                                                    

  Performs a multidimensional FFT of the array A. The optional dims argument specifies an iterable subset of dimensions (e.g. an integer, range, tuple, or array) to transform along.
   [...]

julia> m                                                                      
2×5 Matrix{Float64}:                                                          
 0.801514  1.21987  1.1503   1.18761  1.2485                                  
 0.807469  1.22325  1.14981  1.1877   1.24861                                 
                                                                              
julia> fft(m, (1,)) # first dimension is the column, since julia is column major
2×5 Matrix{ComplexF64}:                                                       
   1.60898+0.0im   2.44312+0.0im  2.30011+0.0im  2.37531+0.0im   2.49711+0.0im
 -0.005955+0.0im  -0.00338+0.0im  0.00049+0.0im  -9.0e-5+0.0im  -0.00011+0.0im

In general, if you type ? at the julia REPL, you’ll enter help mode, where you can enter e.g. the name of a function and it’ll print any associated documentation attached to that function (if any is made available by the package developers).


As an aside, it’s a little hard to read what output you expected, please surround your code in the future with triple backticks (```) to mark them as code :slight_smile: For more information about making it easier for people to help you, please refer to this thread: Please read: make it easier to help you

6 Likes