getPolyRoots(C,tBnd)
% getPolyRoots(C,tBnd)
%
% Given a vector of polynomial coefficients in C, and a bounded interval
% tBnd, getPolyRoots() finds the roots of this polynomial and all of its
% derivatives on the given interval.
%
% INPUTS:
% C = vector of polynomial coefficients, see >>help polyval for format
% tBnd = [tLow, tUpp] = time interval of interest
%
% OUTPUTS:
% R = cell array
% R{1} = vector of roots of the polynomial C, including tBnd
% R{2} = vector of roots of the derivative of C, including tBnd
% ...
% R{n} = vector of roots of the (n-1)th derivative of C
%
% NOTES:
%
% 1) Why this function? There is clearly the matlab command roots().
%
% --> The implementation of this function is efficient for medium-order
% polynomials that have many roots which are not inside of the interval.
% In particular, it performs one root-solve per root found in R, not
% counting the boundary points. Thus, if there are no roots, then there
% is no root solve. Matlab's roots() command computes eigen-values to
% find the roots, and then you need to trim any roots not in the
% interval. This is the method that I use to validate the result of this
% function.
%
% 2) Matlab's roots() command should still be faster because they have an
% awesome vectorized implementation of eig().
%
% --> True. In many cases I suspect that the roots() method will actually
% be faster, since this code is not vectorized. My motivation is that I'm
% using this code to prototype the implementation, which I will later be
% writing up in C++ for other applications. In C++, the for loops in this
% implementation will run quickly.
%
Citation pour cette source
Matthew Kelly (2024). getPolyRoots(C,tBnd) (https://www.mathworks.com/matlabcentral/fileexchange/58136-getpolyroots-c-tbnd), MATLAB Central File Exchange. Récupéré le .
Compatibilité avec les versions de MATLAB
Plateformes compatibles
Windows macOS LinuxCatégories
- MATLAB > Mathematics > Elementary Math > Polynomials >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Découvrir Live Editor
Créez des scripts avec du code, des résultats et du texte formaté dans un même document exécutable.
Version | Publié le | Notes de version | |
---|---|---|---|
1.0.0.0 |