import Cocoa
import Accelerate
let filePath = Bundle.main.path(forResource: \"sinusoid\", ofType: \"txt\")
let contentData = FileManager.default.contents(atPath: filePa
The lengths of your 2 FFT are different, and so, of course the results won't match. You are also passing different amounts of data to your 2 FFTs.
Print out the FFT lengths and the input data vector to debug your code. Make sure the inputs match before comparing results.
Also, Apple's Accelerate/vDSP FFTs can use lengths other than just powers of 2 (lengths with factors of 3 or 5 are also allowed).
Also, note that Matlab indexes arrays starting at 1, not 0, as is more typical in C and Swift functions.