How to plot streamline for velocity data??

39 次查看(过去 30 天)
Hi,
I need to plot velocity vectors along with streamline. For velocity vectors, I have used quiver() as shown below which works properly, please let me know how to plot streamlines.. I have attached velocity data for your reference.. Please help me with this..
skip=2;
ff=quiver(x',y(1:skip:end),Um(1:skip:end,:),Vm(1:skip:end,:));

回答(2 个)

KSSV
KSSV 2021-2-16
  1 个评论
Turbulence Analysis
Hi,
Thanks. I have used as follows, but not getting the proper streamline.. I guess, I am not defining startx, starty in a correct way..
skip=2;
ff=quiver(x',y(1:skip:end),Um(1:skip:end,:),Vm(1:skip:end,:));
ff.Color='black';
ff.AutoScaleFactor=12;
set(gca, 'YDir','normal')
startx = -40:40;
starty = 0:80;
streamline(x,y,Um,Vm,startx,starty);

请先登录,再进行评论。


darova
darova 2021-2-16
try this
clc,clear
[x,y,z] = peaks(20); % some data
[u,v] = gradient(z); % create direction vectors
t = linspace(0,2*pi,5);
[sx,sy] = pol2cart(t,2); % start position (circle)
h = streamline(x,y,u,v,sx,sy); % display streamlines
hold on
for i = 1:length(h) % loop through all streamlines
x1 = get(h(i),'xdata'); % get data
y1 = get(h(i),'ydata');
% u and v vector fields are known
u1 = interp2(x,y,u,x1,y1); % interpolate vector field at streamline position
v1 = interp2(x,y,v,x1,y1);
quiver(x1,y1,u1,v1)
end
hold off

类别

Help CenterFile Exchange 中查找有关 Vector Fields 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by