Extracting the coefficient of a polynomials matrix

2 ビュー (過去 30 日間)
Qian Feng
Qian Feng 2016 年 10 月 30 日
編集済み: Qian Feng 2017 年 3 月 28 日
I want to extract the coefficients of a polynomial matrix P(x) with sym x, which can be decomposed into P0 + P1x + P2x^2 ....
A example can be sym x
P = [1 + x x^2; x^3 x^4];
I understand that one might apply the function coeffi to each entry of P(x) to handle this problem. However, I wonder if there are more efficient ways to achieve this task.

採用された回答

Kwin
Kwin 2016 年 10 月 30 日
You could differentiate and evaluate P at x=0, so
P0 = subs(P, x, 0);
P1 = subs(diff(P), x, 0);
P2 = subs(diff(P,2)/2, x, 0);
P3 = subs(diff(P,3)/factorial(3), x, 0);
P4 = subs(diff(P,4)/factorial(4), x, 0);
would give you your matrices.
In general the nth polynomial matrix of P can be found with,
Pn = subs(diff(P,n)/factorial(n), x, 0);
  1 件のコメント
Qian Feng
Qian Feng 2016 年 10 月 30 日
編集済み: Qian Feng 2017 年 3 月 28 日
Thanks a lot, this is a very smart approach.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolynomials についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by