evaluating the value of the gradient at some point.

조회 수: 6 (최근 30일)
Del
Del 2012년 12월 21일
댓글: Bishwesvar Pratap Singh 2018년 3월 27일
I have
syms x1 x2
f=x1^2+4*x2^2-8*x1-16*x2
f =
x1^2 - 8*x1 + 4*x2^2 - 16*x2
grad_f=gradient(f)
grad_f =
2*x1 - 8
8*x2 - 16
Now, I would like to evaluate the value of the gradient of f at some point, let say (x1,x2)=(1,0).
What should I do?

답변 (1개)

Walter Roberson
Walter Roberson 2012년 12월 21일
subs(grad_f, {x1, x2}, {1, 0})
You will likely want to double() the result of the subs()
  댓글 수: 3
Walter Roberson
Walter Roberson 2012년 12월 21일
double(subs(grad_f, {x1, x2}, {1, 0}))
Bishwesvar Pratap Singh
Bishwesvar Pratap Singh 2018년 3월 27일
Thank you

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by