Code covered by the BSD License

### Highlights from Improved 2-D Streamlines

5.0
5.0 | 2 ratings Rate this file 15 Downloads (last 30 days) File Size: 3.9 KB File ID: #38860 Version: 1.0

# Improved 2-D Streamlines

### Duane Hanselman (view profile)

More comprehensive streamline computation than stream2 in MATLAB.

File Information
Description

XY = MMSTREAM2(X,Y,U,V,X0,Y0,Mark,Step) computes streamlines from gradient data in matrices U and V.
X and Y can be vectors defining the coordinate axes data where U(i,j) and V(i,j) coincide with the coordinates axes points X(j) and Y(i).
Alternatively, X and Y can be 2D plaid matrices as produced by MESHGRID.
X0 and Y0 are equal length vectors defining coordinates that mark the Start, End, or a point On individual streamlines as denoted by the input Mark which is 'Start', 'End' or 'On'. If empty or not given Mark='Start'.
Step identifies the normalized step size used. If empty or not given, Step = 0.1, i.e., 1/10 of a cell. 0.01 <= Step <= 0.5

XY is a cell array containing streamline data points. XY{k}(:,1) contains the x-axis data and XY{k}(:,2) contains the y-axis data for the k-th streamline.

Acknowledgements

This file inspired Pi Vlab Time Resolved Particle Image Velocimetry (Piv) Tool.

Required Products MATLAB
MATLAB release MATLAB 7.2 (R2006a)
29 May 2015 Nick Earnhardt

### Nick Earnhardt (view profile)

Dear Duane,

Well done! It works absolutely perfect for what I need it.

Thanks a lot for sharing.

04 May 2015 Carl Shapiro

### Carl Shapiro (view profile)

Works perfectly!

16 Nov 2012 William Thielicke

### William Thielicke (view profile)

Just one additional idea: Many flow vis tools that offer streamlines have a parameter like "terminal speed" or "maximum steps". Integration is cancelled when the speed is below a certain threshold or the nr. of steps are exceeded.

Comment only
16 Nov 2012 William Thielicke

### William Thielicke (view profile)

Thanks for the submission. I was waiting a long time for a nice streamline function that draws streamlines through a point. But there is one issue: In the PIV analysis of simulated Hamel-Oseen vortices, the streamlines seem to have an infinite length when they reach the vortex cores. MMstream2 does never finish. I added a tic/toc command that cancels the calculation (breaks the "while loops") after a certain time. Maybe you could add something like this? I used the standard settings + the 'on' input.

Comment only