Unable to run symbolic script, MATLAB is making fractions extremely large and unable to handle them

조회 수: 1 (최근 30일)
Hi all,
  댓글 수: 2
sixwwwwww
sixwwwwww 2013년 10월 22일
how much time does MATLAB takes in each iteration on your computer?
sixwwwwww
sixwwwwww 2013년 10월 22일
Yes i made some modifications and program end in almost 48 seconds. But now i m running ur code and its not finished yet. I will post modified program shortly

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

채택된 답변

sixwwwwww
sixwwwwww 2013년 10월 22일
편집: sixwwwwww 2013년 10월 22일
Dear Amit, here is the modified code:
tic
syms x1 x2 x3 a;
f = x1^2+2*x2^2+2*x3^2+2*x1*x2+2*x2*x3;
p=[1,1,1];
no = 10;
tol = 1e-4;
k = 1;
n = 1;
while(no>tol)
gr = [diff(f,x1),diff(f,x2),diff(f,x3)];
gr1 = double(subs(gr,[x1,x2,x3],p));
no = norm(gr1);
d = -1 * gr1;
f1=subs(f,[x1,x2,x3],p+a*d); %problem 1
b = double(solve(diff(f1,a)));
p = p+b*d;
k=k+1;
n=n+2;
t2 = double(subs(f1,[x1,x2,x3,a],[p,b])); %problem 2
fk(k)=t2;
end
disp(p)
toc
I hope it helps. Good luck!

추가 답변 (0개)

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by