4
$\begingroup$

I'd like to apply a high-pass filter to some 2D data. Given the diagram on the documentation page for HighpassFilter, I assume the default window function is a Dirichlet window (i.e. a unit step, which amounts to no smoothing). I'd like to use a gaussian instead. I know I can do this by simply multiplying the FFT of the data by a gaussian, but I'd like to do it using the in-built HighpassFilter function if possible. However, I'm getting an error.

Here's a MWE:

data=RandomReal[{0,1},{40,40}];
cutoff=Pi/10;
HighpassFilter[data,cutoff,Automatic,NormalDistribution[]]]

The error I get is the following:

HighpassFilter::win: "Invalid window type NormalDistribution[0,1]. >>

Clicking on the link merely directs me to the HighpassFilter documentation, which contains a few example window functions and says I can define my own $f$ (which is what I tried to do above).

I tried reducing the data to 1D in case the problem was the gaussian being defined in 1D by default, but I got the same error, so it can't be that.

What am I doing wrong?

Thanks in advance.

$\endgroup$
0
3
$\begingroup$

NormalDistribution[] is a distribution not a function. You want to use its probability density function:

HighpassFilter[data, cutoff, Automatic, PDF[NormalDistribution[]]]
$\endgroup$
1
  • $\begingroup$ Thanks! This works. :) $\endgroup$ – Rain Aug 27 '18 at 17:03

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.