Streamlines to visualize 6-component Electromagnetic data

조회 수: 1 (최근 30일)
Sean Phillips
Sean Phillips 2020년 12월 14일
답변: Akanksha 2025년 6월 10일
I am having trouble understanding and using the streamlines fucntion
I have 6-component electromagnetic data. ie. Ex,Ey,Ez & Hx,HyHz.
X = RX_Mesh;
Y = RY_Mesh; %Km
Z = RZ_Mesh;
startx = X(51:10:101);
starty = Y(101:10:201);
startz = Z(51:10:101);
freq=1
%VECTOR COMPONENTS
ex = Ex; ey = Ey; ez = Ez; %electric vector components
hx = Hy_Total; hy = Hy_Total; hz = Hz_Total; % magnetic vector components
u3 = Sx; v3 = Sy; w3 = Sz; %poynting vector components
close all
streamline(X,Y,Z,ex,ey,ez,startx,starty,startz)
hold on
streamline(X,Y,Z,hx,hy,hz,startx,starty,startz)
using all other functions such as slice, contour, quiver3 etc my data plots as expected so it cannot be the data. I am just not understanding something correctly about the startx,starty,startz

답변 (1개)

Akanksha
Akanksha 2025년 6월 10일
Hey Sean Phillips,
The problem with the code provided is that startx, starty, and startz are defined as 1D vectors, but the streamline function expects them to be 3D grids of the same size. This mismatch causes the streamlines to not generate correctly. Using "meshgrid function to create a proper grid of starting points would fix the issue.
Using the following code will help with your query -
[xs, ys, zs] = meshgrid(X(51:10:101), Y(101:10:201), Z(51:10:101));
streamline(X, Y, Z, ex, ey, ez, xs, ys, zs);
This will ensure that startx, starty, and startz are all the same size and shape, allowing MATLAB to correctly trace streamlines from those seed points.
PFA the links for further reference:
Hope this helps!

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by