Symbolic vectors 'invalid variable name'

9 visualizaciones (últimos 30 días)
Nic
Nic el 24 de Abr. de 2019
Respondida: Nathan Hardenberg el 4 de Mayo de 2022
I am attempting to create a symbolic vector precisely like the one explained here.
Starting with a fresh MATLAB environment, the code:
syms a [1 4]
Causes an error: "Error using syms (line 222). Invalid variable name."
This code creates a 1x1 sym object 'a', but not the expected 1x4 symbolic vector. The exact same error occurs on my own computer running R2018a (academic) and university computers running R2018b (academic). The syms toolbox seems to be working fine as simply using 'syms a' works fine.
All other similar errors seem to be caused by a missing symbolic toolbox or with more complicated code. I can't figure out why something so simple is failing on both systems. Any suggestions are very welcome.

Respuesta aceptada

madhan ravi
madhan ravi el 24 de Abr. de 2019
sym('a',[1 4])
doc sym
  2 comentarios
Nic
Nic el 24 de Abr. de 2019
Thank you. Is there any reason the official documentation for syms doesn't mention this considering it now seems to be wildly outdated?
madhan ravi
madhan ravi el 24 de Abr. de 2019
Editada: madhan ravi el 24 de Abr. de 2019
The documentation you’re seeing is for 2019a version.

Iniciar sesión para comentar.

Más respuestas (1)

Nathan Hardenberg
Nathan Hardenberg el 4 de Mayo de 2022
In my R2021b version your code works without an error. And the output is like one would expect:
syms a [1 4]
display(a)

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by