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

 채택된 답변

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

추가 답변 (1개)

Cris LaPierre
Cris LaPierre 2022년 4월 5일
syms x
y=x^2+2;
symvar(y)
ans = 
x

댓글 수: 2

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.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2022년 4월 5일

댓글:

2022년 4월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by