Filter löschen
Filter löschen

2次元の流線の壁画

35 Ansichten (letzte 30 Tage)
Machi
Machi am 23 Jul. 2024 um 6:13
Kommentiert: Machi am 24 Jul. 2024 um 1:18
streamline(X,Y,Z,U,V,W,startX,startY,startZ)を使用して2次元の流線を描きたいのですが,
始点はどのように定めればいいのでしょうか。
描きたい範囲は1m×1mで,X=Y=U=V=80×80の行列です。
なお,分割数はXとYともに80で,Δx=Δy=0.0125mです。
ご回答よろしくお願いいたします。

Akzeptierte Antwort

covao
covao am 23 Jul. 2024 um 22:55
steamlineは、ベクトル場の可視化手法の一つで、ベクトル場の流れを把握するには、流線の始点をmeshgridを用いてグリッドで設定する方法が考えられます。
以下は2次元のベクトル場で、流線の始点をグリッドで設定し、流れを可視化する例です。
start_nで分割数を調整できます。
コードの作成に生成AIを用いています。
% Define the grid
n = 80; % Number of grid divisions
L = 1; % Range (1m)
[X, Y] = meshgrid(linspace(0, L, n), linspace(0, L, n));
% Lorenz attractor parameters
sigma = 1;
rho = 1/1000;
beta = 1/1000;
% Move the center to the origin
X = X - 0.5;
Y = Y - 0.5;
% Calculate the vector field
U = sigma * (Y - X);
V = X * (rho - 0) - Y;
% Move the center back
X = X + 0.5;
Y = Y + 0.5;
% Define the starting points for the streamlines
start_n = 10; % Number of X,Y divisions for the starting points
[startX, startY] = meshgrid(linspace(0, L, start_n), linspace(0, L, start_n));
% Plot the 2D streamlines
figure;
quiver(X, Y, U, V, 'k'); % Display the vector field
hold on;
streamline(X, Y, U, V, startX, startY);
hold off;
title('Streamline Plot of a Lorenz Attractor-like Vector Field');
xlabel('X (m)');
ylabel('Y (m)');
axis equal;
grid on;
  3 Kommentare
covao
covao am 24 Jul. 2024 um 0:03
妥当なnは、ベクトル場の変動の大きさや流れをどれくらいの解像度で可視化するかによって変わってくるのではないかと思われます。
分割数をいくつか調整して見やすい値を決めるのが良いかと思われます。
あまり細かすぎると線の数が多くなって見にくくなってしまいます。
Machi
Machi am 24 Jul. 2024 um 1:18
ありがとうございます。

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu ライティング、透明度、およびシェーディング finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2024a

Community Treasure Hunt

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

Start Hunting!