# How to plot streamlines ?

7 views (last 30 days)
Sudharsan Srinivasan on 28 Jul 2017
Commented: Eseosa Ekanem on 25 May 2021
Lets say I have channel of length x = 200 and height y = 200. I have my velocity (u and v) distributed throughout the channel of size 200X200 for u and v each. How can I plot streamlines for this ? I have gone through the matlab documentation and am not clear about 'startx' and 'starty'. How should I define this ?

Chad Greene on 28 Jul 2017
One way is to define a bunch of random seed locations within the domain like this:
N = 75; % number of seed locations
xstart = max(x)*rand(N,1);
ystart = max(y)*rand(N,1);
For example, try this:
x = 1:200;
y = 1:200;
[X,Y] = meshgrid(x,y);
vx = 30 + 30*cos((Y-100)*pi/100);
vy = 5*cos(X/10).*cos((Y-100)*pi/100);
figure
pcolor(X,Y,hypot(vx,vy))
N = 75;
xstart = max(x)*rand(N,1);
ystart = max(y)*rand(N,1);
h=streamline(X,Y,vx,vy,xstart,ystart);
set(h,'color','red')
##### 3 CommentsShow 1 older commentHide 1 older comment
RAJA RAMA KRISHNAA B.U on 6 Dec 2018
Edited: RAJA RAMA KRISHNAA B.U on 6 Dec 2018
I have a situation like, I have U and V values of velocity for 1023 frames. Now I need to load it and find a proper streamline plot for all frames at any desirable point.
Eseosa Ekanem on 25 May 2021
Hi Raja, did you find a solution to your problem? I have similar challenge but I want to plot the streamlines for just one frame.