Equations for high pass filter?

I made my own low-pass filter in Matlab, taking a moving average from the signal data. But if the moving average creates a low-pass filter, how specifically to build an equation for the high-pass filter? I understand the intuition about using the average for a low pass (high frequencies will be zero, but low frequencies will on average exceed a number close to the signal value).

But is there any equation used for a high pass filter?

+4
source share
2 answers

There are many equations for this! Perhaps the simplest of them is the spreading function for one sample,

y[n] = x[n] - x[n-1] 

or by taking its z-transform

 H(z) = 1 - z^-1 

Where H(z) = Y(z) / X(z) is the system equation for the filter.

Using AudioLazy with MatPlotLib (Python), you can see the frequency response graph for this high-pass filter by typing. ( Disclosure: I am the author of AudioLazy )

 from audiolazy import z (1 - z ** -1).plot().show() 

Simple highpass filter

You can apply it to the signal as well

 from audiolazy import z, Stream filt = 1 - z ** -1 sig = Stream(1, 3, 1, -1, -3, -1) # Periodic signal filt(sig).take(7) 

Result in the first 7 samples:

 [1.0, 2, -2, -2, -2, 2, 2] 

The same can be done in GNU Octave (or MatLab):

 filter([1, -1], [1], [1, 3, 1, -1, -3, -1, 1]) 

What returns

 [1, 2, -2, -2, -2, 2, 2] 

In this example, an FIR filter is used in a 6-sample periodic signal, which varies from the amplitude range [-3;3] to [-2;2] . If you try a 12-waveform (lower frequency):

 filt = 1 - z ** -1 sig = Stream(1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, 0) filt(sig).take(13) 

Now the result will be another square wave, but in the range [-1;1] . You should try the same with sine waves that make sense for the frequency response and should contain a different sine wave as the filter output with the same frequency.

You can also use a Nyquist frequency resonator by providing you with an IIR filter. There are several other filters that can do this (for example, Butterworth, Chebyshev, Elliptical) for different needs. Minimum phase, linear phase, filter stability, and minimizing ripple amplitudes are some of the possible design goals (or limitations) that can arise when designing a filter.

+8
source

A very simple high-pass filter can be constructed by subtracting the low-pass filter from the original data. Subtracting a low energy content, you are left with a high energy content, creating a high-pass filter. Hope this is intuitive.

 data = %some data here low_pass_data = %calc low pass here high_pass_data = data - low_pass_data 

Please note that @HD has a much more extensive answer, but thought it might be too complicated for the OP.

+8
source

Source: https://habr.com/ru/post/1499261/


All Articles