3次元グラフの断面図を描画することはできますか?

36 visualizaciones (últimos 30 días)
MathWorks Support Team
MathWorks Support Team el 25 de Oct. de 2013
Respondida: MathWorks Support Team el 25 de Oct. de 2013
SURF で描いた3次元グラフにおいて、例えば、x = 0.3 のときの y-z 平面の断面図や稜線を描画する方法を教えてください。

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 25 de Oct. de 2013
4次元のボリュームデータであれば、SLICE 関数を使用して、断面図を表示することができますが、SURF 関数などの表示に使用される3次元データの断面図を表示する機能はありません。
代替案としては、PLOT3 関数を用いて、稜線と、AREA 関数を用いて断面図を表示する方法があります。以下に例を示します。
clear all,close all
% サンプルデータの作成
[x,y,z] = peaks;
figure
surf(x,y,z)
% x軸が 0.3 に最も近い座標を検索
[x_diff,ind] = min(abs(x(1,:)-0.3));
x_point = x(1,ind); % 0.3に最も近い実際の値
% 稜線の重ね書き
hold on
plot3(x_point*ones(size(x(1,:))),y(:,ind),z(:,ind),'Linewidth',3,'color','k')
hold off
% 断面図の表示
figure
area(y(:,ind),z(:,ind))
title(['X = ',num2str(x_point)])
xlabel('Y-axis'),ylabel('Z-axis')

Más respuestas (0)

Etiquetas

Aún no se han introducido etiquetas.

Productos

Community Treasure Hunt

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

Start Hunting!