| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Symbolic Math Toolbox |
| Contents | Index |
| Learn more about Symbolic Math Toolbox |
Y = sort(v)
Y = sort(p)
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.
Sort the elements of a symbolic matrices and vectors:
syms a b c d e; sort(sym(magic(3))) sort([a c e b d])
The results are:
ans = [ 1, 2, 3, 4, 5, 6, 7, 8, 9] ans = [ a, b, c, d, e]
Sort the terms of the polynomial:
syms a b c d e x; sort([a c e b d]*x.^(0:4).')
The result is:
ans = d*x^4 + b*x^3 + e*x^2 + c*x + a
![]() | solve | subexpr (sym) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |