How to plot streamline for velocity data??

조회 수: 35 (최근 30일)
Turbulence Analysis
Turbulence Analysis 2021년 2월 16일
답변: darova 2021년 2월 16일
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
Turbulence Analysis 2021년 2월 16일
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