Bandpass Filter BPFILT-Does this function still exist?

I have some code that uses bpfilt to apply a bandpass filter from 10 - 100 (presumably kHz):
flo=10;
fhi=100;
fdata=bpfilt(data,flo,fhi);
It looks like bpfilt doesn't exist as a function in matlab anymore? Is that true?
From reading other posts, it could also be that I am having trouble accessing the signal processing toolbox? I have this in my apps and it is enabled but I am not sure if that is enough to access the variables. I'm a newbie!
I would be happy to do the bpfilt by other means, but not sure how.
Thanks!!

 Respuesta aceptada

Star Strider
Star Strider el 30 de Abr. de 2019
I can’t find it in the online documentation. If you have R21018a or later, use the bandpass (link) function.
It’s easy to design an efficient elliptical filter with ellipord, ellip, zp2sos and filter it with filtfilt.

6 comentarios

Louise Wilson’s Answer moved here:
Hi Star Strider!
Thanks for getting back to me so quickly.
I have used this code... I think it works but I haven't actually looked at the data yet. Does it look like it makes sense to you?
fs=48000;
flo=10;
fhi=100; % band pass filter bandwidth
fdata=bandpass(data,[flo,fhi],fs);
I don't know what an elliptical filter is-I know hi, low and bandpass only. I'll take a look into this. Thank you!
My pleasure.
It looks correct to me. The bandpass function automatically filters your data. The second output (if you request it) is a digital filter object you can use with the filtfilt function (not filter as suggested in the documentation) to filter other signals with the same filter without having to redesign the filter.
An elliptical filter implementation would be something like this:
fs=48000;
Fn = fs/2;
flo=10;
fhi=100;
Wp = [flo fhi]/Fn; % Bandpass Filter Passband
Ws = [flo-5 fhi+5]/Fn; % Bandpass Filter Stopband
Rp = 1; % Passband Ripple
Rs = 50; % Stopband Ripple / Attenuation
[n,Ws] = ellipord(Wp, Ws, Rp, Rs); % Elliptical Filter Order
[z,p,k] = ellip(n,Rp,Rs,Wp); % Elliptical Filter Design
[sos,g] = zp2sos(z,p,k); % Elliptical Filter Implementation
figure
freqz(sos,2^14,fs) % Check Filter Performance
fdata = filtfilt(sos,g,data); % Filter Signal
Make appropriate changes to get the result you want.
Awesome!! Thank you. This has helped a lot. I will hold onto it.
My pleasure!
If my Answer helped you solve your problem, please Accept it!
Ah sorry-newbie :-)
No worries!
An acceptance tells others that the answer worked.

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Preguntada:

el 30 de Abr. de 2019

Comentada:

el 30 de Abr. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by