sort - Sort symbolic vectors or polynomials

Syntax

Y = sort(v)
Y = sort(p)

Description

Y = sort(v) sorts the elements of a symbolic vector v in numerical or lexicographic order.

Y = sort(p) sorts the terms in a polynomial p in order of decreasing powers.

Examples

syms a b c d e x
sort(sym(magic(3))) = [1,2,3,4,5,6,7,8,9]
sort([a c e b d]) = [a b c d e]
sort([a c e b d]*x.^(0:4).') = 
d*x^4 + b*x^3 + e*x^2 + c*x + a

See Also

sym2poly, coeffs

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS