summaryrefslogtreecommitdiff
path: root/modules/polynomials/macros/sylm.sci
diff options
context:
space:
mode:
authorShashank2017-05-29 12:40:26 +0530
committerShashank2017-05-29 12:40:26 +0530
commit0345245e860375a32c9a437c4a9d9cae807134e9 (patch)
treead51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/polynomials/macros/sylm.sci
downloadscilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip
CMSCOPE changed
Diffstat (limited to 'modules/polynomials/macros/sylm.sci')
-rwxr-xr-xmodules/polynomials/macros/sylm.sci29
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/polynomials/macros/sylm.sci b/modules/polynomials/macros/sylm.sci
new file mode 100755
index 000000000..69ecc64b0
--- /dev/null
+++ b/modules/polynomials/macros/sylm.sci
@@ -0,0 +1,29 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+
+function [s]=sylm(a,b)
+ //[s]=sylm(a,b) gives the Sylvester matrix associated to polynomials
+ //a and b, i.e. the matrix s such that:
+ // coeff( a*x + b*y )' = s * [coeff(x)';coeff(y)']
+ //dimension of s is equal to degree(a)+degree(b)
+ //If a and b are coprime polynomials
+ //(rank(sylm(a,b))=degree(a)+degree(b)) the instructions
+ // u = sylm(a,b) \ eye(na+nb,1)
+ // x = poly(u(1:nb),'z','coeff')
+ // y = poly(u(nb+1:na+nb),'z','coeff')
+ //compute Bezout factors x et y of minimal degree de degre minimal
+ //such that a*x+b*y=1
+ //!
+ na=degree(a);a=coeff(a)';
+ nb=degree(b);b=coeff(b)';
+ s(na+nb,na+nb)=0;
+ for i=1:nb,s(i:na+i,i)=a,end
+ for i=1:na,s(i:nb+i,nb+i)=b,end
+endfunction