필터 지우기
필터 지우기

Substitute an array of number for a symbolic variable

조회 수: 27 (최근 30일)
David Arnold
David Arnold 2012년 11월 1일
댓글: Walter Roberson 2019년 7월 12일
Hi,
I have:
syms x y
f=x^3+y^3+3x^2+2y^2+9
fx=diff(f,x)
now, I'd like to substitute these two vectors of x and y values into the expression fx.
x=[1,2,3,4,5]
y=[6,7,8,9,10]
How do I do that with the subs command? If I can't do that with the subs command, what do you recommend?
David.
  댓글 수: 1
Star Strider
Star Strider 2012년 11월 1일
편집: Star Strider 2012년 11월 1일
Question: Do you want a matrix with the function evaluation of fx for each value of (x,y) as an individual element?
What version of MATLAB do you have? Beginning with 2012a, symbolic functions are possible.

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

채택된 답변

Walter Roberson
Walter Roberson 2012년 11월 1일
subs(fx, {x, y}, {[1,2,4,5,6}, [6,7,8,9,10]})
This syntax is documented relatively far down in the examples.

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 1일
syms x y
f=x^3+y^3+3*x^2+2*y^2+9
fx=diff(f,x)
x=[1,2,3,4,5]
y=[6,7,8,9,10]
eval(f)
eval(fx)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by