Find minimum of a generic polynomial
Show older comments
Hi,
I have to write a script that involves expanding a polynomyc series up to a given degree and then find its minimum(s). What would be an efficient and fast way of computing it? Not sure how I would do it with a generic-degree polynomy.
As an example:
Given a series like
I'd like to program the script that expands the series up to a given degree N and then find its minima, probably derivating the function and evaluating on the points, but maybe there's a faster built-in solution.
Thank!
Answers (1)
roots(polyder(p)) will find the roots of the derivative of p. You can then evaluate the polynomial at all the roots to see where the smallest value is attained.
Example:
p=poly([0 3 4]);
r=roots(polyder(p));
x=linspace(-1,5,1000);
plot(x,polyval(p,x),r,polyval(p,r),'rx')
1 Comment
Image Analyst
on 16 Jan 2023
Very clever/cool, Matt!
Categories
Find more on Polynomials in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!