[Scilab-users] Limit command

Pablo Fonovich pablo_f_7 at hotmail.com
Fri Aug 28 02:45:46 CEST 2015


Hi:
Limit IS a scimax function... i used your script and it worked with some modifications...

First of all, the scilab function "roots" need a variable type polinomial as argument... and the symbolic polynomial made by scimas is not this type of variable, so we need to use scimax's function "sym2poly"...
However, sym2poly needs an expanded polynomial as argument... so we first need to use "expand" on the polynomial we want to calculate the roots... So your final script should be:

z = %z;
Syms n z1;
z = z1
X =z *(3*z -(5/6) ) /((z -(1/4) )*(z -(1/3) ))
X1 = expand(denom (X));
X1=sym2poly(X1,'z1');
zp = roots(X1);
X1 = z1 *(3* z1 -(5/6) ) /(( z1 -(1/4) )*(z1 -(1/3) ))
F1 = X1 *( z1 ^(n -1) )*(z1 -zp (1) );
F2 = X1 *( z1 ^(n -1) )*(z1 -zp (2) );
h1 = limit (F1 ,z1 ,zp (1) );
disp (h1 , ' h1 [ n]= ' )
h2 = limit (F2 ,z1 ,zp (2) );
disp (h2 , ' h2 [ n]= ' )
h = h1+h2;
disp (h, ' h [ n]= ' )

Now, the differences in your script and mine could be because the version of scilab or scimax in which the author programmed that script may not be the lasts ones...

I would recommend you to define polynomials with the native scilab functions... scilab has enough functions for polynomials... the script would be:

X =poly([0 1],'z','coeff')*poly([-5/6 3],'z','coeff') /(poly([-1/4 1],'z','coeff')*poly([-1/3 1],'z','coeff') )
X1 = denom (X);
zp = roots(X1);
X1 = z1 *(3* z1 -(5/6) ) /(( z1 -(1/4) )*(z1 -(1/3) ))
F1 = X1 *( z1 ^(n -1) )*(z1 -zp (1) );
F2 = X1 *( z1 ^(n -1) )*(z1 -zp (2) );
h1 = limit (F1 ,z1 ,zp (1) );
disp (h1 , ' h1 [ n]= ' )
h2 = limit (F2 ,z1 ,zp (2) );
disp (h2 , ' h2 [ n]= ' )
h = h1+h2;
disp (h, ' h [ n]= ' )

and the only function from scimax is the "limit" command
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150827/b2c106d5/attachment.htm>


More information about the users mailing list