How to display a symbolic variable as a number?

1 view (last 30 days)
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 Comments
Star Strider
Star Strider on 5 Jul 2016
I cannot reproduce that behaviour.
I get exactly the result you want when I run your code in R2016a.
Walter Roberson
Walter Roberson on 5 Jul 2016
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

Sign in to comment.

Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!