How Can I define a Polynomial of degree n with symbolic coefficients?

조회 수: 7 (최근 30일)
Ethen
Ethen 2014년 2월 25일
댓글: Ethen 2014년 2월 25일
Hi guys, How can I define a polynomial of degree n with symbolic coefficients. For example, if n=2, P= ax*2+bx+c
Thanks

채택된 답변

John D'Errico
John D'Errico 2014년 2월 25일
편집: John D'Errico 2014년 2월 25일
Whats the problem? This seems clear.
syms x a b c
P = a*x^2+b*x+c;
Are you looking for a general solution for any n? This seems to work:
n = 3;
syms x
P = sym('a',[1,n+1])*x.^(n:-1:0).'
P =
a1*x^3 + a2*x^2 + a3*x + a4

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by