Borrar filtros
Borrar filtros

How can I infer the solutions of a specific polynomial?

1 visualización (últimos 30 días)
Jonas Morgner
Jonas Morgner el 4 de Mayo de 2022
Editada: Matt J el 4 de Mayo de 2022
% A
v1 = [1 -2 -5 6] % Storing the values of the polynomial
% B
v2 = [-100 : .1 : 100] % Sequencing the numbers in .1 steps
% C
y = polyval (v1, v2) % Polyval function
plot(v2, y) % Plotting
How can I infer the solutions of the polynomial?

Respuestas (1)

Matt J
Matt J el 4 de Mayo de 2022
Editada: Matt J el 4 de Mayo de 2022
By "solutions", do you mean the roots? Just use the roots command.
v1 = [1 -2 -5 6] ;
roots(v1)
ans = 3×1
-2.0000 3.0000 1.0000
  1 comentario
Walter Roberson
Walter Roberson el 4 de Mayo de 2022
v1 = [1 -2 -5 6]
v1 = 1×4
1 -2 -5 6
r = roots(v1)
r = 3×1
-2.0000 3.0000 1.0000
mask = imag(r) ~= 0 | real(r) < -100 | real(r) > 100; %remove anything not in -100 to +100
r(mask) = []
r = 3×1
-2.0000 3.0000 1.0000
r
r = 3×1
-2.0000 3.0000 1.0000

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by