File Exchange

image thumbnail


version (1.95 KB) by Star Strider
Reformats coeffs output to conform to MATLAB conventions for polynomial expression and evaluation.


Updated 31 Mar 2016

View License

The coeffs (Symbolic Toolbox) function outputs the coefficients and terms of its argument polynomial in ascending order (opposite of the MATLAB convention for polynomials). It occasionally permutes their sequence, so simply using fliplr doeson't always solve the problem. However, the orders of the coefficient and term vector elements always corresponds. This utility takes as arguments the coefficient (C) and polynomial term (T) vectors that coeffs returns (as [C,T]), and the polynomial variable. It returns both coefficient and term vectors in monic, descending order, conforming to the MATLAB convention. It is particularly helpful for long symbolic coefficients, such as those that define transfer functions in terms of component values to be computed elsewhere (the kind of problem I wrote it to solve). See also the coeffs documentation in the Symbolic Math Toolbox.

Cite As

Star Strider (2020). coeffsort (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Alistair Steyn-Ross

coeffsort() works exactly as advertized to remedy coeff()'s sometimes ideosyncratic ordering of polynomial coefficients. [Note to Symbolic Toolbox engineers: This rank-ordering bug really should be fixed within coeff() itself, eliminating the need for this coeffsort() fix-up.]


BSD License added. No code changes.

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux