MATLAB for に同等の関数はないと思いますRegionPlot3D
。ただし、 を使用surf
して 3D サーフェス プロットを作成し、出力を数学的に処理することができます。たとえば、コードは MATLAB で次のように書き直すことができます。
m=100;
n=100;
% set up the domain points
x = linspace(-1,1,m);
y = linspace(-1,1,n);
% set up the range points
z1 = nan(m,n);
z2 = nan(m,n);
for i=1:m
for j=1:n
zSquared = x(i)^2+y(j)^2; % z^2
if zSquared<=1/2
z1(i,j) = sqrt(zSquared); % the parabola
z2(i,j) = sqrt(1-zSquared); % the ball
end
end
end
AxesHandle=axes();
grid on;
hold(AxesHandle,'all');
surf(AxesHandle,x,y,z1,'EdgeColor','none'); % top part
surf(AxesHandle,x,y,z2,'EdgeColor','none');
surf(AxesHandle,x,y,-z1,'EdgeColor','none'); % bottom part
surf(AxesHandle,x,y,-z2,'EdgeColor','none');
view([-55,16]);
ただし、グラフィックは Mathematica よりも劣ります。乾杯。
