How to plot streamline for velocity data??
12 次查看(过去 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,:));
0 个评论
回答(2 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Vector Fields 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!