Can FILTFILT(B, A, X) yeild the same results as FILTFILT(SOS, G, X) assuming inputs are generated via [z,p,k] = butter(3,Wn) + [sos,g] = zp2sos(z,p,k) and [A,B] = butter(3,Wn)
Hi all,
I am working on a signal processing and bandpass filtering problem which uses a butterworth filter. I was recently advised to try using the [zero, pole, gain] output instead of the [A,B] output (this output returns the filter coefficients in length N+1 vectors B (numerator) and A (denominator)) for increased reliability between matlab versions.
I do not understand the nuances of these different methods. I am getting different result (tradfilt, h_signal, thephase) with each method and want to understand why.
Method 1 Code
Wn = [Fpass(1,1)/(Fs/2) Fpass(1,2)/(Fs/2)]; % normalized by the nyquist frequency
[B,A]= butter(3,Wn)
tradfilt = filtfilt(B,A,signal);
h_signal=hilbert(tradfilt);
thephase=atan2(tradfilt, imag(h_signal));
Method 2 code
Wn = [Fpass(1,1)/(Fs/2) Fpass(1,2)/(Fs/2)]; % normalized by the nyquist frequency
[z,p,k] = butter(3,Wn);
[sos,g] = zp2sos(z,p,k);
tradfilt= filtfilt(sos,g,signal);
h_signal=hilbert(tradfilt);
thephase=atan2(tradfilt, imag(h_signal));
Thanks!Hi all,
I am working on a signal processing and bandpass filtering problem which uses a butterworth filter. I was recently advised to try using the [zero, pole, gain] output instead of the [A,B] output (this output returns the filter coefficients in length N+1 vectors B (numerator) and A (denominator)) for increased reliability between matlab versions.
I do not understand the nuances of these different methods. I am getting different result (tradfilt, h_signal, thephase) with each method and want to understand why.
Method 1 Code
Wn = [Fpass(1,1)/(Fs/2) Fpass(1,2)/(Fs/2)]; % normalized by the nyquist frequency
[B,A]= butter(3,Wn)
tradfilt = filtfilt(B,A,signal);
h_signal=hilbert(tradfilt);
thephase=atan2(tradfilt, imag(h_signal));
Method 2 code
Wn = [Fpass(1,1)/(Fs/2) Fpass(1,2)/(Fs/2)]; % normalized by the nyquist frequency
[z,p,k] = butter(3,Wn);
[sos,g] = zp2sos(z,p,k);
tradfilt= filtfilt(sos,g,signal);
h_signal=hilbert(tradfilt);
thephase=atan2(tradfilt, imag(h_signal));
Thanks! Hi all,
I am working on a signal processing and bandpass filtering problem which uses a butterworth filter. I was recently advised to try using the [zero, pole, gain] output instead of the [A,B] output (this output returns the filter coefficients in length N+1 vectors B (numerator) and A (denominator)) for increased reliability between matlab versions.
I do not understand the nuances of these different methods. I am getting different result (tradfilt, h_signal, thephase) with each method and want to understand why.
Method 1 Code
Wn = [Fpass(1,1)/(Fs/2) Fpass(1,2)/(Fs/2)]; % normalized by the nyquist frequency
[B,A]= butter(3,Wn)
tradfilt = filtfilt(B,A,signal);
h_signal=hilbert(tradfilt);
thephase=atan2(tradfilt, imag(h_signal));
Method 2 code
Wn = [Fpass(1,1)/(Fs/2) Fpass(1,2)/(Fs/2)]; % normalized by the nyquist frequency
[z,p,k] = butter(3,Wn);
[sos,g] = zp2sos(z,p,k);
tradfilt= filtfilt(sos,g,signal);
h_signal=hilbert(tradfilt);
thephase=atan2(tradfilt, imag(h_signal));
Thanks! signal processing, butter, filtfilt, zp2sos, hilbert, gain, pole, zero MATLAB Answers — New Questions