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}];

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"]


  • $\begingroup$ You are not using the same processing methods. Try ScalingFunctions -> "Absolute", and compare against a ListPlot of the Fourier transform, not ListLogPlot. However, as posted, the two plots are identical except for their scale. $\endgroup$ – rcollyer Apr 30 '13 at 16:04
  • $\begingroup$ Figured that as well just this instant. The only issue is still to incorporate the sampling frequency when using Fourier. I will change the question accordingly. $\endgroup$ – Sascha Apr 30 '13 at 16:08
  • $\begingroup$ ListLogPlot applies Log10 to the data and makes y-axis ticks in logarithmic style. But dB aren't just Log10 it's 10*Log10. And also SampleRate needs to be changed to number of data points, 100 in your case. $\endgroup$ – swish Apr 30 '13 at 16:16
  • $\begingroup$ The issue is that my actual data has a sample frequency of 48000Hz and that I can't find any option to tell Fourier that. $\endgroup$ – Sascha Apr 30 '13 at 16:29
samplerate = 48000;
time = Length[data]/samplerate;
nyq = Floor[Length[data]/2]; 
 Take[10*Log10[(Abs@Fourier[data, FourierParameters -> {1, -1}])^2], nyq], 
 Joined -> True, PlotRange -> Full, 
 DataRange -> {0, (nyq - 1)/time}]

enter image description here

Compare with periodigram with given sample rate of 48 kHz:

Periodogram[data, FourierParameters -> {1, -1}, SampleRate -> 48000, 
 PlotRange -> Full, ScalingFunctions -> "dB"]

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.