[Scilab-users] Define numerator and denominator of transfer function as variables in Xcos (DLR block)

Tan Chin Luh chinluh at tritytech.com
Sat Apr 1 16:23:49 CEST 2017


Hi,

If I understand correctly, you would like to create the filter in 
Scilab, and directly access from Xcos?
if so, u could use the syslin object to do so.

1. Create the syslin obj
h1 = wfir("lp",2,[.2 0],"re",[0 0])
h2 = wfir("hp",3,[.1 0],"re",[0 0])
num1 = poly(h1,'z','coeff')
d = ones(1,size(h1,2)+1)
d(1:$-1) = 0
den1 = poly(d,'z','coeff')
H1 = syslin('d',num1,den1)
num2 = poly(h2,'z','coeff')
d = ones(1,size(h2,2)+1)
d(1:$-1) = 0
den2 = poly(d,'z','coeff')
H2 = syslin('d',num2,den2)

2. In Xcos
use H1.num in the numerator block for LPF, H1.den in the denominator for 
the LPF, same for the HPF.

Hope this helps.

rgds,
CL

On 1/4/2017 9:53 PM, Nikolay Strelkov wrote:
> Anybody?
> Dear Tim, do you have any idea?
>
> --
> /With best regards,
> Ph.D., //associate professor at MPEI 
> <http://mpei.ru/lang/en/Pages/default.aspx>,
> IEEE member,
> maintainer of Mathieu functions toolbox for Scilab 
> <http://atoms.scilab.org/toolboxes/Mathieu/>,
> Nikolay Strelkov./
>
> 2017-03-23 14:27 GMT+03:00 Nikolay Strelkov <n.strelkov at gmail.com 
> <mailto:n.strelkov at gmail.com>>:
>
>     Dear all!
>
>     I'm playing with simple digital filtering in Xcos 5.5.2.
>     I have two filters - low-pass and high-pass, connected in series.
>
>     Xcos does not have convolution block.
>     So I write FIR transfer function
>     <https://ccrma.stanford.edu/%7Ejos/fp/FIR_Transfer_Function.html>
>     manually from impulse response function.
>     I get impulse response functions from wfir function.
>
>     Let's assume that we have two simple filters with impulse responses:
>     h1 = [0.3741957    0.3741957]; // it's low-pass filter from h1 =
>     wfir("lp",2,[.2 0],"re",[0 0])
>     and
>     h2 = [- 0.1870979    0.8  - 0.1870979]; // it's high-pass filter
>     h2 = wfir("hp",3,[.1 0],"re",[0 0])
>
>     I convert them to DLR
>     <https://help.scilab.org/docs/5.5.2/en_US/DLR.html> SISOs and get:
>     H1(z) = 0.3741957*z^-1 + 0.3741957*z^-2 = ( 0.3741957*z +
>     0.3741957 ) / (z^2);
>     H2(z) = -0.1870979*z^-1 + 0.8*z^-2  - 0.1870979*z^-3 = (
>     -0.1870979*z^2 + 0.8*z  - 0.1870979*z ) / (z^3);
>     and place their numerator and denominator to the corresponding DLR
>     blocks.
>     Model is in attachment. It's an illustration, not real world example.
>
>     I have a question. How I can automate the aforementioned process
>     programmatically?
>     I tried to create numerator and denominator with poly function and
>     as strings, but Xcos does not support these types in DLR settings.
>
>     --
>     /With best regards,
>     Ph.D., assistant professor at MPEI
>     <http://mpei.ru/lang/en/Pages/default.aspx>,
>     IEEE member,
>     maintainer of Mathieu functions toolbox for Scilab
>     <http://atoms.scilab.org/toolboxes/Mathieu/>,
>     Nikolay Strelkov./
>
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20170401/01aaa151/attachment.htm>


More information about the users mailing list