Azzera filtri
Azzera filtri

2次元の流線の壁画

35 visualizzazioni (ultimi 30 giorni)
Machi
Machi il 23 Lug 2024 alle 6:13
Commentato: Machi il 24 Lug 2024 alle 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です。
ご回答よろしくお願いいたします。

Risposta accettata

covao
covao il 23 Lug 2024 alle 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 Commenti
covao
covao il 24 Lug 2024 alle 0:03
妥当なnは、ベクトル場の変動の大きさや流れをどれくらいの解像度で可視化するかによって変わってくるのではないかと思われます。
分割数をいくつか調整して見やすい値を決めるのが良いかと思われます。
あまり細かすぎると線の数が多くなって見にくくなってしまいます。
Machi
Machi il 24 Lug 2024 alle 1:18
ありがとうございます。

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2024a

Community Treasure Hunt

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

Start Hunting!