[Scilab-users] Unexpected result using horner

Federico Miyara fmiyara at fceia.unr.edu.ar
Wed Jul 20 22:47:14 CEST 2022


Dear All,

I have problems with this script:

Fs  =  44100;
fo  =  500;
B  =  2^(1/6)-2^(-1/6);
// Low-pass Butterworth
hLPs  =  analpf(3,"butt",[],1);
// Band-pass Butterworth centered at fo    
hBPs  =  horner(hLPs,  (2*%pi*fo/%s  +  %s/(2*%pi*fo))/B)
// Apply bilinear transform
hBPz  =  horner(hBPs,  2*Fs*(%z  -  1)/(%z  +  1))
// Attempt to get the same using iir
hBPz1  =  iir(3,  "bp",  "butt",  fo/Fs*[2^(1/6),2^(-1/6)],  [0  0])

I attempt to design a discrete Butterworth band-pass filter using two 
equivalent methods:

1) Manually applying a bilinear transform to the analog filter designed 
with analpf()
2) Applying the function iir()

For some resaon I couldn't figure out, the first method yields an 
unexpected result:

--> hBPz
  hBPz  =
    0.0000005 +0.0000016z +0.0000016z² +0.0000005z³
    -----------------------------------------------
        -0.9671578 +2.9195957z -2.9518237z² +z³

--> hBPz1
  hBPz1  =
                  0.0000006 -0.0000017z² +0.0000017z⁴ -0.0000006z⁶
----------------------------------------------------------------------------- 

    1.0335428 -6.1515162z +15.271063z² -20.239437z³ +15.104038z⁴ 
-6.0176897z⁵ +z⁶

The official function iir() is correct. The manual procedure 
unexpectedly reduces the order of the denominator.

Maybe someone can find out what's going on...

Thanks,

Federico Miyara



-- 
El software de antivirus Avast ha analizado este correo electrónico en busca de virus.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20220720/b89048d7/attachment.htm>


More information about the users mailing list