Borrar filtros
Borrar filtros

Plotting a polynomial represented by a vector

2 visualizaciones (últimos 30 días)
Christopher
Christopher el 6 de Ag. de 2013
say I have a vector such as [1,2,3,4,5] which represents the function x^4 + 2x^3 + 3x^2 + 4x + 5. How could matlab directly interpret a vector as a polynomial function, and plot it? Thanks.

Respuesta aceptada

David Sanchez
David Sanchez el 6 de Ag. de 2013
From MATLAB documentation:
The polynomial p(x) = 3x^2 + 2x + 1 is evaluated at x = 5, 7, and 9 with
p = [3 2 1];
polyval(p,[5 7 9])
which results in ans =
86 162 262
  1 comentario
Christopher
Christopher el 6 de Ag. de 2013
Oh, I see how that works. Just evaluate it over an interval. Thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Polynomials en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by