Borrar filtros
Borrar filtros

Error using streamline function in matlab

3 visualizaciones (últimos 30 días)
mukesh bisht
mukesh bisht el 16 de Jul. de 2021
Editada: Cris LaPierre el 16 de Jul. de 2021
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)

Respuestas (2)

Cris LaPierre
Cris LaPierre el 16 de Jul. de 2021
Editada: Cris LaPierre el 16 de Jul. de 2021
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 el 16 de Jul. de 2021
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.
.

Categorías

Más información sobre Vector Fields en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by