2
$\begingroup$

I have a data here, I want to make sense of Lowpass filtering function in Mathematica.I do not fully understand units of cut off frequency in this option since the data is in frequency space. What I would like to do is to eliminate the small oscillation. It turns out that the Lowpass filter is doing its job

I have done the following.

ListPlot[data, PlotRange -> All, Joined -> True]

enter image description here

and secondly,

ListPlot[Transpose[{data[[All, 1]], 
   LowpassFilter[data[[All, 2]], 0.1]}], Joined -> True, 
 PlotRange -> All, AxesLabel -> {"Frequency (Hz)", "Scaled intensity with offset correction"}]

enter image description here

Here; what is the unit of the cut off frequency which is "0.1".

I know that I should define a sample rate in order to know the cut-off frequency. But from the definition of Lowpass filtering, I saw that the sample rate is automatically defined.

Could anyone please explain me how do I make sense of the cut-off frequency 0.1 and its unit in this example?

$\endgroup$
13
  • 1
    $\begingroup$ Is your data given as a time series or as amplitudes/power for specific frequencies? $\endgroup$ Aug 28, 2017 at 12:43
  • 2
    $\begingroup$ I ask because LowpassFilter[] expects time series data. If your data is given already in the frequency domain you usually just multiply your spectrum by the filter frequency response. $\endgroup$ Aug 28, 2017 at 12:49
  • 3
    $\begingroup$ If you want to know the physical units of the LowpassFilter, you need to be clear on the physical units of your data. You label the vertical axis "Intensity", but this is nonsense since intensity is watts per square metre en.wikipedia.org/wiki/Intensity_(physics) and hence is always positive, yet you show negative values. Your horizontal axis is also suspicious, since you only show a very small part of the frequency axis. You need to describe the meaning of the data in order to know the meaning of the operations carried out on it. $\endgroup$
    – bill s
    Aug 30, 2017 at 14:16
  • 2
    $\begingroup$ Here's what you need at a minimum: how many samples are there in your data per unit of the horizontal axis (frequency, in your case). Usually in a time based filtering, this is samples per second. In your case, you need to specify number of samples per Hz. $\endgroup$
    – bill s
    Aug 30, 2017 at 15:05
  • 2
    $\begingroup$ Since your data is in frequency units, the cut off frequency for LowPassFilter will be in time units. Specifically, since your data is intensities, the cut off will refer to a cut off lag in the autocorrelation function of the amplitude time series behind your intensities. But does that actually mean anything in the context of your problem? If you want to smooth this data, I'd suggest using MovingAverage: at least it will be clear what you're doing. Or you could do some kind of fit. $\endgroup$
    – John Doty
    Aug 30, 2017 at 15:10

1 Answer 1

4
+50
$\begingroup$

After downloading your data, you can see that the sampling rate is:

sr = (Max[data[[All, 1]]] - Min[data[[All, 1]]])/(Length[data] - 1)
400

where sr is in "Hz per sample." This is 1/400 samples per Hz, so when you are choosing the parameter 0.1 for the LowpassFilter, you are selecting a filter with about 1/(0.1/400) = 4000 Hz bandwidth. To check this, make a time series object and lowpassfilter it:

tsData = TimeSeries[data];
ListPlot[LowpassFilter[tsData, 0.1/400]]

enter image description here

Observe that this is identical to your original filtered output given by

ListPlot[Transpose[{data[[All, 1]], LowpassFilter[data[[All, 2]], 0.1]}]]
$\endgroup$
2
  • $\begingroup$ Awesome, Thank you very much bill s, Now I got you. $\endgroup$
    – TM90
    Aug 31, 2017 at 1:55
  • $\begingroup$ Er… I think the bandwidth should be 0.1/(1/400)/(2 Pi)? $\endgroup$
    – xzczd
    Aug 31, 2017 at 2:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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