I have a dataset of amplitude versus time $(t,A(t))$ and I need to extract the dominant frequency and amplitude, and also get the amplitude at one other specific frequency. My data looks like this:
data = {{-9.75, 13.76}, {-9.5, 14.352}, {-9.25, 15.66}, {-9., 16.506}, {-8.75, 17.768},
{-8.5, 17.218}, {-8.25, 15.794}, {-8., 13.18}, {-7.75, 11.58}, {-7.5, 10.524},
{-7.25, 8.428}, {-7., 6.544}, {-6.75, 4.408}, {-6.5, 2.586}, {-6.25, 0.274},
{-6., -2.194}, {-5.75, -4.982}, {-5.5, -6.224}, {-5.25, -9.698}, {-5., -12.22},
{-4.75, -13.986}, {-4.5, -15.372}, {-4.25, -15.1}, {-4., -15.47}, {-3.75, -14.088},
{-3.5, -13.388}, {-3.25, -12.424}, {-3., -12.506}, {-2.75, -11.83}, {-2.5, -9.886},
{-2.25, -8.066}, {-2., -7.434}, {-1.75, -5.23}, {-1.5, -2.418}, {-1.25, 0.252},
{-1., 2.726}, {-0.75, 5.184}, {-0.5, 7.668}, {-0.25, 8.684}, {0., 9.7},
{0.25, 11.866}, {0.5, 13.534}, {0.75, 15.05}, {1., 17.512}, {1.25, 17.99},
{1.5, 16.84}, {1.75, 15.154}, {2., 12.682}, {2.25, 10.358}, {2.5, 9.314},
{2.75, 9.07}, {3., 7.866}, {3.25, 5.244}, {3.5, 2.27}, {3.75, -0.564},
{4., -2.012}, {4.25, -3.078}, {4.5, -5.484}, {4.75, -8.834}, {5., -11.234},
{5.25, -13.162}, {5.5, -15.11}, {5.75, -16.684}, {6., -16.588}, {6.25, -14.99},
{6.5, -14.336}, {6.75, -12.956}, {7., -12.44}, {7.25, -11.72}, {7.5, -10.854},
{7.75, -8.384}, {8., -6.082}, {8.25, -3.848}, {8.5, -1.772}, {8.75, 0.552},
{9., 3.186}, {9.25, 5.154}, {9.5, 6.976}, {9.75, 8.602}, {10., 9.042}}
And I would like to define a function that takes in account the $x$ scaling for proper scaling of the spectrum. The scaling has been discussed in other questions. But there are some issued that are stopping me.
What I have is (mainly copied from here) :
xyF[d_] := Block[{n, t, y, dt, ft, fy},
n = Length[d];
t = d[[All, 1]];
y = d[[All, 2]];
dt = Tally[Differences[t]][[1, 1]];
fy = Abs@Fourier[y];
ft = RotateRight[Range[-n/2, n/2 - 1]/(n dt), n/2];
Sort[Transpose[{ft, fy}], (#1[[1]] < #2[[1]]) &]
]
My questions are:
What is the scaling if the number of points
n
is odd instead of even?How do I obtain a high-resolution estimation of the dominant frequency?
How do I get the intensity of a frequency not explicitly given? (Other than interpolating, given that close to the peak that interpolation may be poor.)