Coeffs functions needs revision

1 回表示 (過去 30 日間)
Robert
Robert 2016 年 10 月 8 日
コメント済み: Robert 2016 年 10 月 10 日
I have now spent half a day digging through piles of code because no one has apparently caught this before
The coeffs function has serious inconsistancy within and should be changed by math works at the source level
I might also add no where in the documentation does it tell you the coeffs function returns its values in the form of the highest or lowest power first. Causing me to loose half a day of work
When used alone it returns the lowest power first
syms x
c = coeffs(16*x^2 + 19*x + 11)
c =
[ 11, 19, 16]
When used with an additional variable it returns with highest power first
syms x
[c,t] = coeffs(16*x^2 + 19*x + 11)
c =
[ 16, 19, 11]
t =
[ x^2, x, 1]
This has caused me much headache today and NEEDS TO BE DOCUMENTED BY MATLAB or at a minimum additional functionality should be added to select the order of how you want the powers to be returned.
I hope this post saves someone else the time i lost today

回答 (1 件)

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2016 年 10 月 10 日
According to matlab documentation you should use
c = coeffs(16*x^2 + 19*x + 11,'All')
  1 件のコメント
Robert
Robert 2016 年 10 月 10 日
You missed the point The point is the order of coefficients is reverses not that they are missing Matlab just called me and confirmed it was a bug and needs to be fixed

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

カテゴリ

Help Center および File ExchangeFormula Manipulation and Simplification についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by