三次元空間にあるベクトルから流線を表示する方法

조회 수: 11 (최근 30일)
知真 梶山
知真 梶山 2023년 6월 8일
답변: COVAO 2024년 2월 2일
初学者です.
以下のような三次元空間上に529個の離散点(x,y,z)があり,それぞれの点に対してベクトル(u,v,w)が割り当てられています.
これらのベクトル分布から流線を表示する方法を探しています.
流線の表示には streamline 関数が用意されていると思いますが,使い方がよく分かりません.
アドバイスをお願いいたします.
可能であれば,流線の表示まで行っていただけますと幸いです.
load results
quiver3(S.x,S.y,S.z,S.u,S.v,S.w,'AutoScaleFactor',.4,'LineWidth',1) % ベクトルの分布を表示
view([90 360 40])

답변 (1개)

COVAO
COVAO 2024년 2월 2일
以下は、大気の流れのベクトルと流線をプロットする例です。
quiver3, streamlineを用いています。
steamlineのドキュメントの例に基づいて作成しています。
  • meshgridで16 個の架空粒子の開始位置を定義しています。粒子はすべて x = 80 からスタートし、20 ~ 50 の範囲の開始 y 位置と 0 ~ 15 の範囲の開始 z 位置をもちます。
  • 大気の流れにおける startXstartYstartZ という一連の開始位置に置かれた架空粒子について、3-D 流線の頂点データを計算します。
% Load the wind data set which includes wind velocity components (u,v,w) and grid coordinates (x,y,z)
load wind;
% Extract a subset of the grid coordinates and wind velocity components
X = x(5:10,20:25,6:10); % Extract a subset of x-coordinates
Y = y(5:10,20:25,6:10); % Extract a subset of y-coordinates
Z = z(5:10,20:25,6:10); % Extract a subset of z-coordinate
U = u(5:10,20:25,6:10); % Extract a subset of u-component of wind velocity
V = v(5:10,20:25,6:10); % Extract a subset of v-component of wind velocity
W = w(5:10,20:25,6:10); % Extract a subset of w-component of wind velocity
% Create a 3D quiver plot to visualize the vectors
quiver3(x,y,z,u,v,w); % Plot vectors as arrows
% Define the starting points for streamlines
[startX,startY,startZ] = meshgrid(80,20:10:50,0:5:15); % Create a 3D grid of starting points
% Compute 3D streamlines from vector data
verts = stream3(x,y,z,u,v,w,startX,startY,startZ); % Compute streamlines for the vector field
lineobj = streamline(verts); % Plot the streamlines
% Set the view and axis properties for the plot
view(3); % Set the view to 3D
axis equal; % Set the aspect ratio of the plot to be equal

카테고리

Help CenterFile Exchange에서 ベクトル場에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!