Clear Filters
Clear Filters

Streamlines spacing in streamslice function

2 views (last 30 days)
Hi,
Just curious about what determines the spacing between the streamlines when using the streamslices function. It says it draws "well spaced streamlines", but not sure what that means.
When I use the matlab example:
load wind
vel=sqrt(u(:,:,1).^2+v(:,:,1).^2)
pcolor(x(:,:,1),y(:,:,1),vel);shading flat;hold on
streamslice(x(:,:,1),y(:,:,1),u(:,:,1),v(:,:,1))
It does not look like the streamlines are closer together when the velocities are higher, which makes me wonder why does the spacing changes.
Would appreciate if anyone has an anwser!
Cheers,
Camille
  2 Comments
darova
darova on 25 Aug 2021
Looks like you created your own Z coordinate. But velocity field is standard.
[x,y,z] = peaks(30);
[u,v] = gradient(z);
ind = true(30);
ind(3:end-2,3:end-2) = false;
pcolor(x,y,z)
shading flat
streamline(x,y,u,v,x(ind),y(ind))
Joel Fischer
Joel Fischer on 13 Jun 2022
Looking at the source code (R2021a) it appears the density of streamlines is not proportional to the magnitude of the vector field. Instead the algorithm tracks the local density on a grid to avoid placing new streamlines that whould come to close to already existing ones.

Sign in to comment.

Answers (0)

Categories

Find more on Vector Fields in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!