필터 지우기
필터 지우기

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

조회 수: 36 (최근 30일)
MathWorks Support Team
MathWorks Support Team 2013년 10월 25일
답변: MathWorks Support Team 2013년 10월 25일
SURF で描いた3次元グラフにおいて、例えば、x = 0.3 のときの y-z 平面の断面図や稜線を描画する方法を教えてください。

채택된 답변

MathWorks Support Team
MathWorks Support Team 2013년 10월 25일
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')

추가 답변 (0개)

태그

아직 태그를 입력하지 않았습니다.

제품

Community Treasure Hunt

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

Start Hunting!