division by zero problem

조회 수: 6 (최근 30일)
Teerapong Poltue
Teerapong Poltue 2020년 11월 7일
댓글: Teerapong Poltue 2020년 11월 7일
I'm running the code
syms a b c
interval = [-3:0.1:3];
a= interval ;
b= interval;
c= interval;
[A,B,C] = meshgrid(a,b,c);
cur = subs(k,{x y z},{A B C});
which k is given by
syms x y z
f = cos(x) + cos(y) + cos(z);
fx = diff(f,x);
fy = diff(f,y);
fz = diff(f,z);
fxx = diff(fx,x);
fxy = diff(fx,y);
fxz = diff(fx,z);
fyx = diff(fy,x);
fyy = diff(fy,y);
fyz = diff(fy,z);
fzx = diff(fz,x);
fzy = diff(fz,y);
fzz = diff(fz,z);
mat = [fxx fxy fxz fx; fyx fyy fyz fy; fzx fzy fzz fz; fx fy fz 0];
no = det(mat);
de = (fx^2 + fy^2 + fz^2)^2;
k = de/no;
But it turns out that
Error using symengine
Division by zero.
Error in sym/subs>mupadsubs (line 160)
G = mupadmex('symobj::fullsubs',F.s,X2,Y2);
Error in sym/subs (line 145)
G = mupadsubs(F,X,Y);
Error in curvature (line 41)
cur = subs(k,{x y z},{A B C});

채택된 답변

Matt J
Matt J 2020년 11월 7일
k = matlabFunction(de/no);
[A,B,C] = meshgrid(-3:0.1:3);
cur = k(A,B,C);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by