how can i slice the symbolic function converted with matlabfunction?

조회 수: 2 (최근 30일)
Moein
Moein 2014년 10월 1일
댓글: Moein 2014년 10월 1일
hi friends
i have a symbolic function that i want to slice it. i converted it with "matlabfunction". now i want to create slice with it but it errors
my code is too long and here there is a code like my code. then i should use sym functions.
the code like my code:---------------------------------------------------------------
syms x y z
r = x^2 + y^2 + z^2;
s = matlabFunction(r);
[x,y,z] = meshgrid(-2:.2:2,-2:.25:2,-2:.16:2);
xslice = [-1.2,.8,2]; yslice = 2; zslice = [-2,0];
slice(x,y,z,s,xslice,yslice,zslice)
colormap hsv
----------------------------------------------------------------------
help me if you can
thanks a lot

채택된 답변

Sean de Wolski
Sean de Wolski 2014년 10월 1일
You need to evaluate the function s() at the points on the grid:
slice(x,y,z,s(x,y,z),xslice,yslice,zslice)
  댓글 수: 1
Moein
Moein 2014년 10월 1일
yessss
it works correctly!!!
i will submit my paper next week with your help.
thanks a lot Saen De Wolski

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

추가 답변 (1개)

Mischa Kim
Mischa Kim 2014년 10월 1일
편집: Mischa Kim 2014년 10월 1일
Moein, this seems to be a duplicate of your other question. For the above problem/function you could simply use
[x,y,z] = meshgrid(-2:.2:2,-2:.25:2,-2:.16:2);
r = x.^2 + y.^2 + z.^2;
xslice = [-1.2,.8,2]; yslice = 2; zslice = [-2,0];
slice(x,y,z,r,xslice,yslice,zslice)
colormap hsv
  댓글 수: 1
Moein
Moein 2014년 10월 1일
i know this solution, but i said this is not my code. it's a code like my code, so i should use the symbolic function and use matlabfunction to convert it.

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

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by