how to write a code that:
- Reads any polynomial P
- Finds its roots.
- Shows the degree of the polynomial.
- Calculates P^3 - Plots the polynomials P and P^3 on a suitable domain specified by the user

 Respuesta aceptada

Birdman
Birdman el 21 de Oct. de 2017
syms x
p(x)=x^2+2*x-3;%as an example
Coeff=coeffs(p(x))';
Coeff=wrev(Coeff);
Roots=roots(Coeff);%roots
Degree=length(Coeff)-1;%degrees
disp(p^3)%calculates p^3
x=0:0.1:1;
plot(x,p(x));grid on;%plots

3 comentarios

Walter Roberson
Walter Roberson el 21 de Oct. de 2017
Note that wrev requires wavelet toolbox. You can use flipud() in this context.
Birdman
Birdman el 21 de Oct. de 2017
Thank you Walter, nice to learn.
Ahmad Dalabeeh
Ahmad Dalabeeh el 21 de Oct. de 2017
thank you very much brothers

Iniciar sesión para comentar.

Más respuestas (1)

Krishan Kumar
Krishan Kumar el 28 de Sept. de 2020

0 votos

syms x p(x)=x^2+2*x-3;%as an example Coeff=coeffs(p(x))'; Coeff=wrev(Coeff); Roots=roots(Coeff);%roots Degree=length(Coeff)-1;%degrees disp(p^3)%calculates p^3 x=0:0.1:1; plot(x,p(x));grid on;%plots

Categorías

Más información sobre Polynomials en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 21 de Oct. de 2017

Respondida:

el 28 de Sept. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by