Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


share|improve this question
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. – rcollyer Apr 30 '13 at 16:04
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. – Sascha Apr 30 '13 at 16:08
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. – swish Apr 30 '13 at 16:16
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. – Sascha Apr 30 '13 at 16:29
up vote 4 down vote accepted
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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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