Analog Bessel filter output problem (nan)

조회 수: 1 (최근 30일)
Amy Lg
Amy Lg 2022년 4월 8일
댓글: Amy Lg 2022년 4월 12일
I need to apply a normalized analog low pass bessel filter to my signal. I am not sure if my code is correct for analog filter. When I use below code, matlab gives Nan as the filtered signal. I appreciate any help to correct my code.
sig = MY SIGNAL;
sig_length = 5000001; % my signal length
fs = 10000e9 % sampling rate
fcut = 3e9; % cutoff frequency(GHz)
order = 4;
wo = 2*pi*fcut;
[z,p,k] = besself(order, wo,'low');
[num,den] = zp2tf(z,p,k); % Convert to transfer function form
filteredSignal = filtfilt(num,den, sig);
freqs(num,den)

답변 (1개)

Paul
Paul 2022년 4월 8일
The num and den inputs to filtfilt() are for a discrete-time filter. But besself() returns the numerator/denominator for a continuous-time filter.
If you want to filtfilt() the signal with the Bessel filter, you'll need to transform it to a discrete-time approximation using methods such as bilinear() or impinvar() in the Signal Processing Toolbox, or others avaialble in the Control System Toolbox. Keep in mind that the magnitude response with filtfilt() is the square of the magnitude response of the filter being used, so the magnitude of the discrete-time approximation is what's important.
If you want to do the forward/backward filtering with the continuous-time Bessel filter, I'm afraid you'll either have to write your own code or perhaps use Simulink to solve the ODE with sig as the input, then go in reverse. Of course you'll then have to decide on how the ODE solver is to compute values of the input signal between the samples in sig (assuming use of something higher than a first order solver). Also, filtfilt() takes some action to deal with transients that may have to be considered if writing your own code.
  댓글 수: 1
Amy Lg
Amy Lg 2022년 4월 12일
Hi Paul,
Thank yo so much for your explanation.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Analog Filters에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by