sosfit in filter function

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

sosfit in filter function


There is a numerical instability on butter function, as described in (topic "Limitations").

Is recommend use [z, p, k] syntax and sosfilt function to apply a
second-order section filter, as described in

But, the documentation of SOSFILT is not clear:

Someone have an idea about how to use ZPK Design instead a TF Design in this
code below?

n = 5;
hpf = 50;
lpf = 10*hpf;
sampling_rate = 44100;

typenoise = noise(60*sampling_rate, 1, 'pink');
[b,a] = butter(n, [hpf/(sampling_rate/2), lpf/(sampling_rate/2)]);
filtered = filter(b, a, typenoise);
audiowrite (filename.wav, filtered, sampling_rate);

freqz (b, a, 4096, sampling_rate)
ax = findall (gcf, 'type', 'axes');
set (ax, 'xlim', [hpf/4 lpf*4]);
set (ax, 'xscale', 'log');
subplot (2, 1, 1);
set (gca, 'ylim', [-35 3]);

Best regards,

Sent from: