在syms符号数学中,怎么表示变量xi。
Afficher commentaires plus anciens
问题:在符号数学中,我想定义N个变量(N也是符号对象),x1,x2,...xi,...xN, 定义f关于这些变量的函数,如f = x1+x2+...+xN,求f关于变量xi的偏导数。
请大家指教,如何才能实现呢,谢谢。
我自己的思路是以x(i)表示xi,运行以下代码,报错,原因是x(i)不能表示变量。
syms i x(i) f N; %x(i)表示变量xi
f = symsum(x(i), i, 1, N) %表示f = x1+x2+...+xi+...+xN
d(i) = diff(f, x(i)) %x(i)表示不了变量xi,那该怎样表示呢?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!