MATLAB: How to Plot Path lines

pathlineplotvector

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.

Best Answer

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');