syms back to numbers
Show older comments
I am using syms to calculate equations with derivatives. I need to assign these syms number values to complete the analysis.
syms x y z
f=x^3 - 2 * y^4 + 4 * z^2
x=4
y=3
z=5
f=
Answers (1)
Sean de Wolski
on 4 Feb 2014
Use subs to substitute the values in:
syms x y z
f=x^3 - 2 * y^4 + 4 * z^2
subs(f,{x,y,z},{4,3,5})
And
6 Comments
Philosophaie
on 4 Feb 2014
Edited: Philosophaie
on 4 Feb 2014
Sean de Wolski
on 4 Feb 2014
huh?
Please provide a minimal working example.
Philosophaie
on 4 Feb 2014
Walter Roberson
on 4 Feb 2014
There does not appear to be any "p" or "t" in your g_ ?
What values are you extracting for the variables, and what result do you get for the substitution, and what result are you expecting for the substitution ?
Philosophaie
on 4 Feb 2014
Walter Roberson
on 5 Feb 2014
What does Affinity look like before substitution? And please cross-check that rr, theta, phi, and tt are all scalars.
Categories
Find more on Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!