Uncategorized

Unstable high-pass filter on mouse-generated signal using Python


I am practicing some DSP techniques along with desktop application development using Python and PyQt. In my filter design application, I am able to create a filter by placing zeros and poles on a unit circle plot and then apply this filter to imported signal data or generate a signal by the movement of the mouse on a mouse pad area I defined in my code. However, a weird effect happened, when I generated a signal by mouse and applied a high-pass filter (zero at (0.5, 0) and pole at (-0.9, 0), a zigzag pattern (I don’t exactly know what its name is) appeared in the filtered data, like it was multiplied by the whole signal. though this effect doesn’t happen on an imported signal.
In my code, I am using SciPy to apply the filter in the following line:

self.filtered_data = signal.lfilter(
        self.numerator, self.denominator, self.original_data
    ).real

As for the signal generation, I’m just getting the ‘y’ values of mouse movement along a PyQtgraph plotwidget.

The Designed Filter
The Mouse-Generated Signal before and after
Can anyone just refer to what the reason may be to learn it and solve it?



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *