How to display a symbolic variable as a number?

조회 수: 1 (최근 30일)
Mitchell
Mitchell 2016년 7월 5일
댓글: Walter Roberson 2016년 7월 5일
I am trying to assign a value to a symbolic variable but it is not working.
Here is an example:
syms l0 phi0(t)
r0=0.5*l0*sin(phi0(t))
When use subs nothing changes
subs(r0,l0,2)
ans = 0.5*l0*sin(phi0(t))
when I want it to show
ans=sin(phi0(t))
This causes problems later on in my code when I am trying to solve a system of equations and it thinks that l0 is still a variable.
  댓글 수: 2
Star Strider
Star Strider 2016년 7월 5일
I cannot reproduce that behaviour.
I get exactly the result you want when I run your code in R2016a.
Walter Roberson
Walter Roberson 2016년 7월 5일
I would suggest renaming from l0 to L0 because l0 looks too much like 10 and you might be overlooking a place you think is l0 but is really 10

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by