The filter is unstable, and that is the problem. You can see this if you look at the coefficients returned by cheby1 and analyse it first with the freqz function:
fs = 1000;
Fn = fs/2;
Wp = [0.05 10]/Fn;
Rp = 1;
[b,a] = cheby1(8,Rp,Wp);
figure
freqz(b,a, 2^16, fs)
It is always best to use aero-pole-gain representation initially and then second-order-section realisation. Prorotype code that does this for an elliptic filter is:
Fs = 256000;
Fn = Fs/2;
Ws = [48 62]/Fn;
Wp = [0.99 1.01].*Ws;
Rp = 1;
Rs = 90;
[n,Wp] = ellipord(Wp,Ws,Rp,Rs);
[z,p,k] = ellip(n,Rp,Rs,Wp,'stop');
[sos,g] = zp2sos(z,p,k);
figure
freqz(sos, 2^20, Fs)
set(subplot(2,1,1), 'XLim',Wp*Fn.*[0.8 1.2])
set(subplot(2,1,2), 'XLim',Wp*Fn.*[0.8 1.2])
This creates a stable filter.
Note that frequency-selective filters will only work for band-limited noise. if the signal has broadband noise, wavelet denoising or other appropriate approaches will be required.
.
Best Answer