how can i slice the symbolic function converted with matlabfunction?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Moein
am 1 Okt. 2014
Kommentiert: Moein
am 1 Okt. 2014
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
0 Kommentare
Akzeptierte Antwort
Sean de Wolski
am 1 Okt. 2014
You need to evaluate the function s() at the points on the grid:
slice(x,y,z,s(x,y,z),xslice,yslice,zslice)
Weitere Antworten (1)
Mischa Kim
am 1 Okt. 2014
Bearbeitet: Mischa Kim
am 1 Okt. 2014
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
Siehe auch
Kategorien
Mehr zu Conversion Between Symbolic and Numeric finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!