How to Plot Path lines

40 Ansichten (letzte 30 Tage)
Ceren GURKAN
Ceren GURKAN am 16 Jun. 2014
Kommentiert: Dennis Dunn am 5 Okt. 2017
Hi everybody,
I have my coordinate data -X and Y vectors- and my velocity vectors U and V all being the same size. I would like to plot path lines of my fluid particles which are flowing through a porous medium. With these 4 known vectors any suggestions on how to do that??
Thanks in advance.

Akzeptierte Antwort

Kelly Kearney
Kelly Kearney am 16 Jun. 2014
Can you show the exact code you tried when calling quiver and streamline? And the specific error you see? Repeated x- and y-coordinates due to data being on a grid is expected by streamline. I assume you tried something along the lines of this?
W = load('wind');
xlim = [min(W.x(:)) max(W.x(:))];
ylim = [min(W.y(:)) max(W.y(:))];
sx = rand(100,1)*diff(xlim) + xlim(1);
sy = rand(100,1)*diff(ylim) + ylim(1);
quiver(W.x(:,:,1), W.y(:,:,1), W.u(:,:,1), W.v(:,:,1));
hold on;
hl = streamline(W.x(:,:,1), W.y(:,:,1), W.u(:,:,1), W.v(:,:,1), ...
sx(:), sy(:));
set(hl, 'color', 'r');
  5 Kommentare
Ceren GURKAN
Ceren GURKAN am 17 Jun. 2014
Kelly thanks for your precious help, now I understand how it works and now streamlines look in the way that I want.
Dennis Dunn
Dennis Dunn am 5 Okt. 2017
You asked for "pathlines", but this solution gives "streamlines". Note that they are different. Streamlines are instantaneous tangent lines, i.e. massless particles in a steady field. Pathlines are time-dependent and can be used in unsteady fields for inertial particles too. You may want to change the title of the question to reflect that if "streamlines" were indeed what you needed.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Star Strider
Star Strider am 16 Jun. 2014
I do not know exactly what you want to do, however at least one of the Vector Fields plotting functions will likely do what you want.
  4 Kommentare
Star Strider
Star Strider am 16 Jun. 2014
The unique function does not work well with floating point data because of inherent floating-point approximation error. I suggest you not use it with those data.
The contour and surf plots (with quiver3 may also do what you want, but since I don’t know your data, I can only suggest you experiment with them until you get the result you want.
The only other options I can think of are plot and plot3. They are relatively simple, but they may work in your applicataion. (You may have to segment your data to use the line plots.)
Ceren GURKAN
Ceren GURKAN am 16 Jun. 2014
Thanks a lot, I will consider your suggestions and share here the results :)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Vector Fields finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by