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

 채택된 답변

Birdman
Birdman 2017년 10월 21일

1 개 추천

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

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

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Krishan Kumar
Krishan Kumar 2020년 9월 28일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Polynomials에 대해 자세히 알아보기

태그

질문:

2017년 10월 21일

답변:

2020년 9월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by