Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.1.0 - English


varn

symbolic variable of a polynomial or a rational

Syntax

symb = varn(p)
pm = varn(p, varname)

Arguments

p

matrix of polynomials or of rationals. In Scilab, only univariate polynomials and rationals are supported. In a matrix, all polynomials or rationals have the same symbolic variable name.

symb, varname

Characters string: current or new name of the symbolic variable. Allowed characters are the same as for variables names (see naming rules).

pm

matrix of polynomials or of rationals, equal to p, with its variable name set to varname.

Description

symb=varn(p) returns in symb the name of the symbolic variable of polynomials p.

varn(p,'s') returns a polynomial matrix with same coefficients as p but with 's' as symbolic variable (change of variable name).

varn([]) yields [].

Examples

With a matrix of polynomials:

s = poly(0,'s'); p = [s , 1-s^2]
v = varn(p)
typeof(v)
px = varn(p,'x')
px == p
--> s = poly(0,'s'); p = [s , 1-s^2]
 p  =
           2
   s   1 -s

--> v = varn(p)
 v  =
 s

--> typeof(v)
 ans  =
 string

--> px = varn(p,'x')
 px  =
           2
   x   1 -x

--> px == p
 ans  =
  T T

With a matrix of rationals:

f = %z/(%z-1); f = [f f^2]
varn(f)
fx = varn(f, "x")
fx == f
--> f = %z/(%z-1); f = [f f^2]
 f  =
                 2
     z          z
   -------  -----------
                      2
   -1 + z   1 - 2z + z

--> varn(f)
 ans  =
 z

--> fx = varn(f, "x")
 fx  =
                 2
     x          x
   -------  -----------
                      2
   -1 + x   1 - 2x + x

--> fx == f
 ans  =
  T T

See also

  • poly — Polynomial definition from given roots or coefficients, or characteristic to a square matrix.
  • rlist — Scilab rational fraction function definition
  • naming rules — Naming rules for variables and functions

History

VersionDescription
5.5.1

Extension to rationals

6.0.0
  • The name of the symbolic variable is no longer limited to 4 characters. It can now include extended UTF-8 characters.
  • varn([]) now returns [] instead of routing to %s_varn().
Report an issue
<< sylm Polynomials Signal Processing >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jun 17 17:49:16 CEST 2024