필터 지우기
필터 지우기

geting answer in variable format , i want in number format.

조회 수: 1 (최근 30일)
Shantanu K
Shantanu K 2013년 3월 24일
z = sym('2*x1 * x1 + x2*x2 + 3*x3*x3');
syms x1 x2 x3 ;
gradz = [diff(z,x1); diff(z,x2); diff(z,x3)];
x1(1)=2;
x2(1)=-2;
x3(1)=1;
%for k=2:5
p=subs(gradz, [x1 x2 x3], [x1(1) x2(1) x3(1)]);
I am getting answer in variable format,,,,,,i want in number format....so how i should get it?

답변 (1개)

Walter Roberson
Walter Roberson 2013년 3월 24일
If there are no remaining symbolic variables in p, then double(p) to get the double precision equivalent.
  댓글 수: 2
Shantanu K
Shantanu K 2013년 3월 24일
Thanks Walter for your response. Then what i should do? when i use for loop then it create problem in calculation of p
Walter Roberson
Walter Roberson 2013년 3월 24일
? What should you do about what ?

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

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by