已知n的数值,怎么去创建n个变量就是如果n=4,需要建立n1 n2 n3 n4,有没有函数可以解决这个问题呢,求大佬解答

 Respuesta aceptada

0 votos

syms函数(超链接,自己点进去看) 里面就有示例,比如 syms n [ 1 4 ]
但实际使用中,除非真的需要四个符号变量做符号计算,这种搞n1 n2 n3 n4的写法,在数值运算中,一般直接写作向量n,然后调用n( 1 )到n( 4 )

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!