필터 지우기
필터 지우기

syms back to numbers

조회 수: 2 (최근 30일)
Philosophaie
Philosophaie 2014년 2월 4일
댓글: Walter Roberson 2014년 2월 5일
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=

답변 (1개)

Sean de Wolski
Sean de Wolski 2014년 2월 4일
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
Philosophaie
Philosophaie 2014년 2월 4일
Actually g_ did evaluate correctly, a 4x4.
The problem came in Affinity, a 4x4x4 with an error code:
??? Error using ==> maple
Error, (in index/FillInitVals) array defined with 1 indices, used with 3 indices
Error in ==> sym.subs at 229
NEWf = sym(maple('evalm',strrep(NEWf,'MATRIX','array')));
Error in ==> SchwarzchildAnalysis_Excel>Evaluate at 65
subs(Affinity,{r,h,p,t},{rr,theta,phi,tt})
Walter Roberson
Walter Roberson 2014년 2월 5일
What does Affinity look like before substitution? And please cross-check that rr, theta, phi, and tt are all scalars.

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

Community Treasure Hunt

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

Start Hunting!

Translated by