I have got some impulse response data that I would like to transform via Fourier
to get the amplitude-frequency characteristics of the performing loudspeaker. The final goal is to show (e.g. via ListDensityPlot
) how the calculated amplitude-frequency characteristics is dependant on the window I choose to transform (truncation of low frequencies). The issue I have is to get Fourier
to behave like desired - I am unable to reproduce the frequency response that I got out of another 3rd part software. The issue:
There is no SampleRate
option for Fourier
(and I got a sampling frequency of 48kHz)
The following example illustrates the issues:
data = Table[Sin[x], {x, 0, 100}];
ListPlot[
Take[10*Log10[(Abs@Fourier[data, FourierParameters -> {1, -1}])^2],
Floor@(Length[Fourier[data, FourierParameters -> {1, -1}]]/2)],
Joined -> True, PlotRange -> Full]
Periodogram[data, FourierParameters -> {1, -1}, SampleRate -> 1,
PlotRange -> Full, ScalingFunctions -> "dB"]
Answer
samplerate = 48000;
time = Length[data]/samplerate;
nyq = Floor[Length[data]/2];
ListPlot[
Take[10*Log10[(Abs@Fourier[data, FourierParameters -> {1, -1}])^2], nyq],
Joined -> True, PlotRange -> Full,
DataRange -> {0, (nyq - 1)/time}]
Compare with periodigram with given sample rate of 48 kHz:
Periodogram[data, FourierParameters -> {1, -1}, SampleRate -> 48000,
PlotRange -> Full, ScalingFunctions -> "dB"]
Comments
Post a Comment