Hello, I want to do digital filtering of an digitized signal. The Matlab-function y=filter(A, B, x) would do exactly what I need. A(denominator) and B(numerator) contain the coefficients of the digital filter H(z). I couldn't find any equivalent function in Scilab. What function in Scilab is quivalent to this filter()-function from Matlab? Best regards, Helmut

# y=filter(A,B,x) how?

Started by ●June 25, 2005

Reply by ●June 25, 20052005-06-25

Helmut Sennewald wrote:> Hello, > > I want to do digital filtering of an digitized signal. > > The Matlab-function > > y=filter(A, B, x) > > would do exactly what I need. A(denominator) and B(numerator) > contain the coefficients of the digital filter H(z). > > I couldn't find any equivalent function in Scilab. > > What function in Scilab is quivalent to this filter()-function > from Matlab? > > Best regards, > Helmut > >Scilab is definitely a different critter from Matlab. In Scilab you would first make a transfer function (they call them "rational matricies"), then extract the time-domain response of the filter with the input. So: H = poly(B, 'z') / poly(A, 'z'); y = flts(x, H); I prefer Scilab's approach to control and systems problems -- I'm hoping that their simulator gets a better GUI soon. There's a scilab newsgroup out there that is worth watching if you're going to be using it. -- ------------------------------------------- Tim Wescott Wescott Design Services http://www.wescottdesign.com

Reply by ●June 25, 20052005-06-25

"Tim Wescott" <tim@seemywebsite.com> schrieb im Newsbeitrag news:11br2jlsviactfe@corp.supernews.com...> Helmut Sennewald wrote: >> Hello, >> >> I want to do digital filtering of an digitized signal. >> >> The Matlab-function >> >> y=filter(A, B, x) >> >> would do exactly what I need. A(denominator) and B(numerator) >> contain the coefficients of the digital filter H(z). >> >> I couldn't find any equivalent function in Scilab. >> >> What function in Scilab is quivalent to this filter()-function >> from Matlab? >> >> Best regards, >> Helmut > Scilab is definitely a different critter from Matlab. > > In Scilab you would first make a transfer function (they call them > "rational matricies"), then extract the time-domain response of the filter > with the input. > > So: > > H = poly(B, 'z') / poly(A, 'z'); > y = flts(x, H); > > I prefer Scilab's approach to control and systems problems -- I'm hoping > that their simulator gets a better GUI soon. There's a scilab newsgroup > out there that is worth watching if you're going to be using it. > > -- > ------------------------------------------- > Tim Wescott > Wescott Design Services > http://www.wescottdesign.comHello Tim, I searched the web and gambled with the Scilab functions until I have got the expected result. The function rtitr() seems to be doing the job. The example below runs a stored data sequence two times through a 4th degree lowpass filter. The second pass is done with the sequence reversed(last sample first). The result is a zero delay dual pass 4th order Butterworth filter. Best regards, Helmut http://www.abdn.ac.uk/~psy359/dept/Papers/obsavoid.pdf "The raw X-, Y- and Z-coordinates of each IRED were digitally filtered by a dual pass through a 2nd-order Butterworth filter with a cut-off frequency of 20 Hz (equivalent to a 4th-order filter with no phase lag and a cut-off of ~16 Hz)." Scilab example -------------- ! fg=0.02*fs fs=10kHz t=(0:1e-4:0.1); sigbase=sin(2*%pi*t*50)+0.5*sin(2*%pi*t*150); signoise=sigbase+0.5*sin(2*pi*t*1100); [hz]=iir(4,'lp','butt', [0.02 0], [0 0]); y1=rtitr(hz(2),hz(3),signoise); y2for=rtitr(hz(2),hz(3),y1); for j=1:1001, y1rev(1,j)=y1(1002-j);end ; y20rev=rtitr(hz(2),hz(3),y1rev); for j=1:1001, y2rev(1,j)=y20rev(1002-j);end ; xbasc plot2d(t,signoise,style=3); plot2d(t,sigbase,style=1); plot2d(t,y2for,style=4); plot2d(t,y2rev,style=5);

Reply by ●June 25, 20052005-06-25

Hello, sorry, I forgot the % in front of pi in one place. "Helmut Sennewald" <helmutsennewald@t-online.de> schrieb im Newsbeitrag news:d9kba0$v3u$02$1@news.t-online.com...> > "Tim Wescott" <tim@seemywebsite.com> schrieb im Newsbeitrag > news:11br2jlsviactfe@corp.supernews.com... >> Helmut Sennewald wrote: >>> Hello, >>> >>> I want to do digital filtering of an digitized signal. >>> >>> The Matlab-function >>> >>> y=filter(A, B, x) >>> >>> would do exactly what I need. A(denominator) and B(numerator) >>> contain the coefficients of the digital filter H(z). >>> >>> I couldn't find any equivalent function in Scilab. >>> >>> What function in Scilab is quivalent to this filter()-function >>> from Matlab? >>> >>> Best regards, >>> Helmut >> Scilab is definitely a different critter from Matlab. >> >> In Scilab you would first make a transfer function (they call them >> "rational matricies"), then extract the time-domain response of the >> filter with the input. >> >> So: >> >> H = poly(B, 'z') / poly(A, 'z'); >> y = flts(x, H); >> >> I prefer Scilab's approach to control and systems problems -- I'm hoping >> that their simulator gets a better GUI soon. There's a scilab newsgroup >> out there that is worth watching if you're going to be using it. >> >> -- >> ------------------------------------------- >> Tim Wescott >> Wescott Design Services >> http://www.wescottdesign.com > > Hello Tim, > > I searched the web and gambled with the Scilab functions until I > have got the expected result. The function rtitr() seems to > be doing the job. > > The example below runs a stored data sequence two times > through a 4th degree lowpass filter. The second pass > is done with the sequence reversed(last sample first). > The result is a zero delay dual pass 4th order Butterworth filter. > > Best regards, > Helmut > > > > http://www.abdn.ac.uk/~psy359/dept/Papers/obsavoid.pdf > "The raw X-, Y- and Z-coordinates > of each IRED were digitally filtered by a dual pass through a > 2nd-order Butterworth filter with a cut-off frequency of 20 Hz > (equivalent to a 4th-order filter with no phase lag and a cut-off > of ~16 Hz)." > > > > Scilab example > -------------- > > ! fg=0.02*fs fs=10kHz > > t=(0:1e-4:0.1); > > sigbase=sin(2*%pi*t*50)+0.5*sin(2*%pi*t*150); > > signoise=sigbase+0.5*sin(2*pi*t*1100);signoise=sigbase+0.5*sin(2*%pi*t*1100);> > [hz]=iir(4,'lp','butt', [0.02 0], [0 0]); > > y1=rtitr(hz(2),hz(3),signoise); > > y2for=rtitr(hz(2),hz(3),y1); > > for j=1:1001, y1rev(1,j)=y1(1002-j);end ; > > y20rev=rtitr(hz(2),hz(3),y1rev); > > for j=1:1001, y2rev(1,j)=y20rev(1002-j);end ; > > xbasc > plot2d(t,signoise,style=3); > plot2d(t,sigbase,style=1); > plot2d(t,y2for,style=4); > plot2d(t,y2rev,style=5); > >