Home /
Expert Answers /
Computer Science /
mathlab-write-a-function-called-rootplot-that-finds-the-roots-of-a-polynomial-and-then-plots-both-pa787

MATHLAB

Write a function called rootplot that finds the roots of a polynomial, and then plots both the polynomial and its roots. The function should take 2 inputs: a vector of polynomial coefficients, and a vector domain at which to evaluate and plot the polynomial. The function should have 2 outputs: the root(s) of the polynomial, and the polynomial evaluated at the input domain vector. The function should also plot the polynomial with a black line, and the roots with red circles.

Here's an example implementation of the `rootplot` function in Python, which uses NumPy...