Here is an example of how to use FourierParameters
for interpolating a spectrum.
First we generate some data, take the ordinary Fourier transform and plot.
data = Table[Sin[\[Pi] k/33], {k, 256}] // N;
ListLinePlot[data]
ft = Fourier[data, FourierParameters -> {-1, -1}];
ListLinePlot[Abs@ft[[1 ;; 128]], PlotRange -> All]
ListPlot[Abs@ft[[1 ;; 20]], PlotRange -> All]
The last, expanded view of the spectrum shows that there are rather few points defining the peak.
The following Dynamic
enables the interpolation to be seen when FourierParameters
are altered. The actual frequency and the magnitude of the Fourier peak should be
(* {0.0151515, 0.511146} *)
DynamicModule[{b = 1, pos, a = 0, ft, freqs},
ft = Abs@Fourier[data, FourierParameters -> {-1, b}];
pos = Position[ft, Max[ft]][[1, 1]];
freqs = Table[(n - 1)/Length[data], {n, Length[data]}];
Column[{
Dynamic[
Row[{"Frequency (Hz) = ", a[[1]], " Magnitude = ", a[[2]] }]],
Dynamic@ListLinePlot[Transpose[{freqs, ft}], PlotRange -> All,
Epilog -> {Red, PointSize[0.01],
Point[a = Transpose[{freqs, ft}][[pos]]]},
ImageSize -> 12 72, Frame -> True, Mesh -> All],
Slider[Dynamic[b, {b = #;
ft = Abs@Fourier[data, FourierParameters -> {-1, b}];
freqs = Table[b (n - 1)/Length[data], {n, Length[data]}];
pos = Position[ft, Max[ft]][[1, 1]]
} &], {0, 1}, Appearance -> "Labeled"]
}]
]
As you can see we can get many more points into the peak and have thus interpolated the spectrum. Thus we can more accurately work out the frequency.
Hope that helps.
Fourier
in the "Details and Options" section clearly says "To ensure a unique inverse discrete Fourier transform,Abs[b]
must be relatively prime to n. »" and "Some common choices for {a,b} are {0,1} (default), {-1,1} (data analysis), {1,-1} (signal processing). ". $\endgroup$Fourier
still computes the transform of a sequence, even if the choice of parameters mean that the transform is not invertable. The question is how it does that, and in particular whether the transform is still "fast" ($O(n \log(n))$). Also, there are many values ofFourierParameters
which make the transform still invertable (i.e. no warning is shown), but would seem to break the naive FFT algorithm. If anything, this makes it even more mysterious howFourier
does what it does. $\endgroup$Fourier
is simply meaningless in that case. Can you ground "Also, there are many values of FourierParameters which make the transform still invertable (i.e. no warning is shown), but would seem to break the naive FFT algorithm. "? TIA. $\endgroup$