How to compute cross terms
古いコメントを表示
Is there a function to compute cross terms of a vector? For example, if I have (symbolically) a = [ a1, a2, a3];
Then the cross terms of a for order 2 would be:
[ a1^2, a2^2, a3^2, a1*a2, a1*a3, a2*a3]
And cross terms for order 3 would be:
[ a1^3, a1^2*a2, a1^2*a3, a1*a2^2, a1*a2*a3, a1*a3^2, a1^2*a2, a1*a2^2, a1*a2*a3, a2^3, a2^2*a3, a2*a3^2, a1^2*a3, a1*a2*a3, a1*a3^2, a2^2*a3, a2*a3^2, a3^3] (this contains duplicates which I want to avoid)
It's very close to the expansion of (a1+a2+a3)^3, but I want the individual terms instead of the sum. I also want it numerically, but symbolically would work if I can convert it.
Is there a Matlab function that takes a vector and computes these cross terms?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Numeric Solvers についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!