Get coefficients of complex equation
古いコメントを表示
I am trying to get coefficients of Quadric Surfaces in General Form like here: http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/geometry/simple.html
My code is:
args=[1,1,1,0,0,0,0,0,-5,0];
a=args(1);b=args(2);c=args(3);d=args(4);e=args(5);f=args(6);g=args(7);h=args(8);m=args(9);s=args(10); %M=i , j = s
syms x y z real
Q=[a,d,e,g;
d,b,f,h;
e,f,c,m;
g,h,m,s];
X=[x,y,z,1]';
func(x,y,z)=X'*Q*X;
[A,B]=coeffs(func)
My problem is that I don't get coefficients all those with zeros values my result should be : [1,1,1,0,0,0,0,0,-5,0]
I get : [ 1, 1, 1, -10]
How do I get the zeros as well
採用された回答
その他の回答 (1 件)
Walter Roberson
2013 年 3 月 15 日
0 投票
By default, coeffs() extracts coefficients with respect to the indeterminates. If a particular symbol has disappeared because its only multiplier was 0, then it is not an indeterminate of the expression and its coefficient will not be extracted by default.
カテゴリ
ヘルプ センター および File Exchange で Mathematics and Optimization についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!