RealSignal
RealSignal

Reputation: 21

How to determine order and cut-off of butterworth filter?

I am trying to desing optimal high-pass filter to remove glitches from the signal. At the begining, I tried to apply butterworth high-pass filter on the sinusoidal 5 Hz signal.

% Sample rate and time vector
Fs = 1000;            % Sampling frequency (Hz)
t = 0:1/Fs:1;         % Time vector (1 second duration)

% Create a simple signal with a glitch
signal = sin(2*pi*5*t);               % A sine wave at 5 Hz
signal(500:510) = signal(500:510) + 2; % Introduce a glitch

% Define high-pass filter characteristics
cutoff_frequency = 4; % Cutoff frequency (Hz)
order = 8;            % Filter order

% Design and apply the high-pass filter
[b, a] = butter(order, cutoff_frequency / (Fs/2), 'high');
filtered_signal = filter(b, a, (signal));

Order 8, cut-off frequency 4 Hz

In this case everything seems okay and filter worked well. However, changing cut-off frequency to below 3 Hz makes everyting complicated.

Order 8, cut-off frequency 2 Hz

I can't understand why output signal distorted dramatically. What is going on here ? Do you have any suggestion for this problem ?

Upvotes: 2

Views: 325

Answers (0)

Related Questions