I'm looking at the inverse fast Fourier transform as calculated by Matlab. In the question "What's the correct way to shift zero frequency to the center of a Fourier Transform?" the way to implement Fast Fourier Transform in Mathematica from the fft(x) function in Matlab is discussed.
I have a dataset obtained by:
n=80;
data = Table[0.25 Sin[2 Pi/n i], {i, 1, n}];
(*data={0.019614773931961236`,0.03910861626005772`,0.05836134096397635`,0.07725424859373686`,0.09567085809127245`,0.11349762493488669`,0.1306246411789872`,0.14694631307311828`,0.16236201208254591`,0.17677669529663687`,0.19010149140000773`,0.20225424859373686`,0.21316004108852307`,0.22275163104709197`,0. 23096988312782168`,0.23776412907378838`,0.24309248009941914`,0.24692208514878444`,0.249229333433282`,0.25`,0.249229333433282`,0.24692208514878444`,0.24309248009941914`,0.23776412907378838`,0.23096988312782168`,0.22275163104709197`,0.21316004108852307`,0.20225424859373686`,0.19010149140000773`,0.17677669529663687`,0.16236201208254591`,0.14694631307311828`,0.1306246411789872`,0.11349762493488669`,0.09567085809127245`,0.07725424859373686`,0.05836134096397635`,0.03910861626005772`,0.019614773931961236`,0.`,-0.019614773931961236`,-0.03910861626005772`,-0.05836134096397635`,-0.07725424859373686`,-0.09567085809127245`,-0.11349762493488669`,-0.1306246411789872`,-0.14694631307311828`,-0.16236201208254591`,-0.17677669529663687`,-0.19010149140000773`,-0.20225424859373686`,-0.21316004108852307`,-0.22275163104709197`,-0.23096988312782168`,-0.23776412907378838`,-0.24309248009941914`,-0.24692208514878444`,-0.249229333433282`,-0.25`,-0.249229333433282`,-0.24692208514878444`,-0.24309248009941914`,-0.23776412907378838`,-0.23096988312782168`,-0.22275163104709197`,-0.21316004108852307`,-0.20225424859373686`,-0.19010149140000773`,-0.17677669529663687`,-0.16236201208254591`,-0.14694631307311828`,-0.1306246411789872`,-0.11349762493488669`,-0.09567085809127245`,-0.07725424859373686`,-0.05836134096397635`,-0.03910861626005772`,-0.019614773931961236`,0.`}*)
Applying the Fast Fourier Transform, fft(data), as in Matlab, we have:
fftdata = Fourier[data, FourierParameters -> {1, -1}];
(*dataf={0.` +0.` I ,0.7845909572784495`-9.969173337331279`I ,0.` +0.`I ,-1.0132180413547489`*^-16+4.185075451078514`*^-17 I ,0.` +0.`I ,1.3040059557750693`*^-16+2.6410775711049507`*^-16 I ,0.` +0.`I ,1.0308349246799976`*^-16-8.596848547326573`*^-17 I ,0.` +0.`I ,6.195506605672999`*^-17-1.6170461347458928`*^-16 I ,0.` +0.`I ,-1.9168912264360062`*^-16+2.0378880969845271`*^-16 I ,0.` +0.`I ,8.455403687140775`*^-17-6.729919522439383`*^-17 I ,0.` +0.`I ,-2.7755575615628914`*^-17+0.` I ,0.` +0.` I ,-3.893734216480464`*^-16-4.990258457628567`*^-16 I ,0.` +0.` I ,1.2592784991282853`*^-16-9.763574303309503`*^-17 I ,0.` +0.`I ,1.212504750441666`*^-16+1.0253813603191403`*^-16 I ,0.` +0.` I ,-4.253376814093551`*^-17+1.8137312595174412`*^-16 I ,0.` +0.` I ,-7.937975984179655`*^-17-3.8528542273131027`*^-16 I ,0.` +0.` I ,-2.5700391915483936`*^-17-8.898211079852906`*^-17 I ,0.` +0.` I ,-1.9723049703512393`*^-17-4.864219214722241`*^-18 I ,0.` +0.` I ,2.220446049250313`*^-16-8.881784197001252`*^-16 I ,0.` +0.` I ,-2.849755553531622`*^-17-7.58912956781088`*^-16 I ,0.` +0.` I ,-2.0048093906176696`*^-17-1.8985077351448689`*^-16 I ,0.` +0.` I ,3.512738297648335`*^-17+1.2979997047241213`*^-16 I ,0.` +0.` I ,9.565284753614687`*^-17-8.728316437179962`*^-17 I ,0.` +0.` I ,9.565284753614687`*^-17+8.72831643717996`*^-17 I ,0.` +0.` I ,3.5127382976483314`*^-17-1.2979997047241205`*^-16 I ,0.` +0.` I ,-2.0048093906176696`*^-17+1.8985077351448686`*^-16 I ,0.` +0.` I ,-2.3791346432658713`*^-17-9.169375983050538`*^-17 I ,0.` +0.` I ,2.325315327167679`*^-16-9.49924319129199`*^-16 I ,0.` +0.` I ,-1.972304970351243`*^-17+4.864219214722272`*^-18 I ,0.` +0.` I ,-2.5700391915483936`*^-17+8.898211079852904`*^-17 I ,0.` +0.` I ,-7.937975984179656`*^-17+3.852854227313102`*^-16 I ,0.` +0.` I ,-4.2533768140935505`*^-17-1.8137312595174415`*^-16 I ,0.` +0.` I ,1.2125047504416658`*^-16-1.0253813603191397`*^-16 I ,0.` +0.` I ,1.2592784991282855`*^-16+9.763574303309504`*^-17 I ,0.` +0.` I ,-4.56351734695374`*^-16+6.196258398420469`*^-16 I ,0.` +0.` I ,3.2980515196221534`*^-17-4.539341797738586`*^-16 I ,0.` +0.` I ,8.455403687140775`*^-17+6.729919522439382`*^-17 I ,0.` +0.` I ,-1.9168912264360062`*^-16-2.037888096984527`*^-16 I ,0.` +0.` I ,6.195506605673002`*^-17+1.6170461347458923`*^-16 I ,0.` +0.` I ,1.0308349246799979`*^-16+8.596848547326578`*^-17 I ,0.` +0.` I ,1.304005955775069`*^-16-2.6410775711049507`*^-16 I ,0.` +0.` I ,-1.0132180413547492`*^-16-4.185075451078515`*^-17 I ,0.` +0.` I ,0.7845909572784494` +9.96917333733128` I }*)
I would expect to get data when applying InverseFourierTransform to fftdata. I also tried using FourierParameters for that.
ifftdata1 = InverseFourier[fftdata];
ifftdata2 = InverseFourier[fftdata, FourierParameters -> {1, -1}];
However it doesn't work. Please, can anybody help me?
FourierParametersis key. When you use the same parameters for the forward and inverse you get back what you started with (except for numerical noise). I have put some notes onFourierhere. – Hugh Nov 24 '21 at 11:42