There is a file exchange message from Steve Morris, which finds all the real roots of the functions at a given interval. He does this by interpolating the polynomial by the Chebychev polynomial and finding its roots.
You can change the eig score of the companion matrix there eigs . This allows you to find only one (or several) roots and save time (there is a chance that Chebychev’s roots or extremes can be calculated analytically, although I could not find a good link for this (or even bad) one in this regard ...) )
Another attempt you can make in speeding up is that the polyder does nothing more than
Pprime = (numel(P)-1:-1:1) .* P(1:end-1);
for your polynomial P In addition, roots does nothing more than search for the eigenvalues of the matrix of related devices, so you can find these eigenvalues yourself, which prevents roots from being called. This can be useful because calls to non-built-in functions inside a loop prevent the Matlab JIT compiler from translating the loop into machine language. Otherwise, this can lead to a large increase in speed (ratios of 100 or more are not uncommon).
source share