IIR butter filter is not stable
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Alex sinWave
am 29 Mai 2022
Kommentiert: Star Strider
am 30 Mai 2022
Hi,
I am trying to make an IIR filter to a sound wave using butter(); , but the output worked in the first time I started the code then never run correctly after.
I have searched and found that makeing IIR using buttur(); sometimes gives unstable outpot and to overcome this problem I have to use z p k way ([z,p,k] = butter()) but I really do not know how to apply them to my sound signal if anyone can help m I will be thankful.
here is the part of the filters that is not working correctly in my code
[X,Fs] = audioread(filename);
temp = Fs/2;
[num2 , denum2] = butter(50, 170/temp, 'low');
y2 = filter(num2, denum2, X);
[num3 , denum3] = butter(50,[171 310]/temp, 'bandpass');
y3 = filter(num3, denum3, X);
[num4 , denum4] = butter(50,[311 600]/temp, 'bandpass');
y4 = filter(num4, denum4, X);
[num5 , denum5] = butter(50,[601 1000]/temp, 'bandpass');
0 Kommentare
Akzeptierte Antwort
Star Strider
am 30 Mai 2022
Use second-order-section representation for stability and filtfilt to do the actual filtering —
[X,Fs] = audioread(filename);
temp = Fs/2;
[z2,p2,k2] = butter(50, 170/temp, 'low');
[sos2,g2] = zp2sos(z2,p2,k2);
y2 = filtfilt(sos2,g2, X);
[z3,p3,k3] = butter(50,[171 310]/temp, 'bandpass');
[sos3,g3] = zp2sos(z3,p3,k3);
y3 = filtfilt(sos3,g3, X);
[z4,p4,k4] = butter(50,[311 600]/temp, 'bandpass');
[sos4,g4] = zp2sos(z4,p4,k4);
y4 = filtfilt(sos4,g4, X);
[z5,p5,k5] = butter(50,[601 1000]/temp, 'bandpass');
[sos4,g4] = zp2sos(z5,p5,k5);
y5 = filtfilt(sos5,g5, X);
.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Digital Filter Design finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!