Right filter syntax for the [z,p,k] syntax

Technical Source
1 min readMar 3, 2021

--

Hi, I used the butterworth filter with the [b,a] syntax:

filtord=4;  
SampleRate=20000;
d = fdesign.bandpass('N,F3dB1,F3dB2',4,100, 300,SampleRate);
hd = design(d,'butter');
% zero phase shift by reverse filtering
SignalFiltered=filtfilt(b,a, Signal);

Now I want to use higher order filter numbers where the help suggests to switch to the [z,p,k] syntax.

Wn=[100,300]/(SampleRate/2);  % cutoff frequencies normalized by nyquist
ftype='bandpass';
filtord=10;
[z, p, k] = butter(filtord,Wn,ftype);
[sos,g]=zp2sos(z,p,k);
hd=dfilt.df2sos(sos,g);

Simple question: would will be the appropriate filter command (SignalFiltered=filtfilt(??))? Or is there a missing piece of code? Thanks for your advice!

P.S.: Is the missing code the following:

[b,a]= sos2tf(hd.sosMatrix,hd.ScaleValues);
SignalFiltered=filtfilt(b,a, Signal);

???????

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

n general you don’t want to switch back to b and a because you then have the numerical issue again.

If you have at least MATLAB R2011a, you can do

SignalFiltered = filtfilt(hd.sosMatrix,hd.ScaleValues,Signal);

Otherwise, you can do

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet