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
Chad Greene 2017년 7월 28일

2 개 추천

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))
shading interp
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

I'm not sure what your application is, but you may alternatively consider quiver. Just downsample the field, perhaps with imresize like this:
x = 1:200;
y = 1:200;
[X,Y] = meshgrid(x,y);
vx = 30 + 30*cos((Y-100)*pi/100);
vy = 15*cos(X/10).*cos((Y-100)*pi/100);
figure
pcolor(X,Y,hypot(vx,vy))
shading interp
sc = 1/10;
hold on
quiver(imresize(X,sc),imresize(Y,sc),imresize(vx,sc),imresize(vy,sc),'r')
Above I used sc = 1/10 to downsample by a factor of 10.
RAJA RAMA KRISHNAA B.U
RAJA RAMA KRISHNAA B.U 2018년 12월 6일
편집: RAJA RAMA KRISHNAA B.U 2018년 12월 6일
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
Eseosa Ekanem 2021년 5월 25일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Vector Fields에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by