find out dependent variables from an expression

syms x(t)
y=x^2+2;
symvar(y)
It gives the ans as t.
Desired output is x. How to get the desired output.
Thanks in advance

 Respuesta aceptada

syms x(t)
y=x^2+2;
findSymType(y, 'symfun')
ans = 

Más respuestas (1)

syms x
y=x^2+2;
symvar(y)
ans = 
x

2 comentarios

Arpan Laha
Arpan Laha el 5 de Abr. de 2022
I have my functions in x(t) form only.
Then the symvar is t, as you see. symvar returns symbolic variables in an expression. As you have set it up, x and y are symbolic functions, not variables. t is the only symbolic variable.

Iniciar sesión para comentar.

Categorías

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

Productos

Versión

R2022a

Preguntada:

el 5 de Abr. de 2022

Comentada:

el 11 de Abr. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by