How to compute cross terms
Mostrar comentarios más antiguos
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?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Numeric Solvers en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!