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)
댓글 수: 0
답변 (2개)
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)
댓글 수: 0
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.
.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Vector Fields에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!