Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道是否有可以解决多项式公式的Matlab代码。我可以为多项式公式中的有限项编写代码,例如(x_{1}+x_{2}+x_{3})^4. 但是对于一般情况,我发现这并不容易,即 (x_{1}+x_{2}+ .... +x_{m})^n
(x_{1}+x_{2}+x_{3})^4
(x_{1}+x_{2}+ .... +x_{m})^n
我将您的问题解释为:使用符号工具箱,如何扩展多项式
(x_{1} + x_{2} + .... + x_{m})^n
能够看到它的所有系数?
我给你的答案是:
m = 2; n = 3; X = sym('x', [1,m]); expand(sum(X)^n)
这将产生:
>> x1^3 + 3*x1^2*x2 + 3*x1*x2^2 + x2^3