Error using streamline function in matlab

8 次查看(过去 30 天)
Hi
I am trying to plot the velocity vector and streamline from the data (file attached). The "quiver" function plots the velcoity vector but when I use "Streamline" function for the same data the figure shows no streamlines.
Attached Figure1 for velcoity vector, Figure2 for streamline plot
Code:
quiver(X,Z,U,W)
streamline(X,Z,U,W,startx,startz)

回答(2 个)

Cris LaPierre
Cris LaPierre 2021-7-16
编辑:Cris LaPierre 2021-7-16
Make sure your starting points are inside the vector field, and streamlines will plot.
load mukeshbisht_matlab.mat
quiver(X,Z,U,W)
startx = -2.9:.1:-1;
starty = 1:0.1:2.9;
hold on
plot(startx,starty,'rx')
hold off
axis equal
figure
streamline(X,Z,U,W,startx,starty)

Star Strider
Star Strider 2021-7-16
The ‘startx’ vector is incorrect.
Try this —
LD = load('mukesh bisht matlab.mat');
U = LD.U;
W = LD.W;
X = LD.X;
Z = LD.Z;
% startx = LD.startx; % Incorrect Values
startz = LD.startz;
startx = X(1,:).'; % Working Values
figure
quiver(X,Z,U,W)
hold on
streamline(X,Z,U,W,startx,startz)
hold off
axis('equal')
The plot is still not exactly what I would expect, however it is definitely closer to the desired result.
.

类别

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