# How can I get velocity values for stream3 function

조회 수: 3(최근 30일)
댓글: darova 6 Apr 2020
Hello,
I have a 3D flow domain in which I have created matrix format of x, y , z coordinates as well as u , v , w for my velocity vector. I would like to do a particle tracing for the particle release from a cetrain coodrnates. Then I would like to have x , y, z coordinates and u, v, w values of the particle along it's trajectory (my final aim is to calculate the particle travel time within the domain released from a specfic point).
I used the following codes to get the coordinates of the particle along it's path (x,y,z,u,v,w are known):
[sx,sy,sz] = meshgrid(2.6,2.6,-5);
XYZ_Data=stream3(x,y,z,u,v,w,sx,sy,sz);
However, I don't know how can I get the velocity vector of the corresponding coordinates of XYZ_Data! It would be really appreciated if anybody could help me in this issue.
Bests,

로그인 to comment.

### 채택된 답변

darova 6 Apr 2020
A short example
clc,clear
cla
[sx sy sz] = meshgrid(80,20:10:50,0:5:15);
h = streamline(stream3(x,y,z,u,v,w,sx,sy,sz));
xx = get(h,'xdata');
yy = get(h,'ydata');
zz = get(h,'zdata');
ii = 10;
x1 = xx{ii};
y1 = yy{ii};
z1 = zz{ii};
u1 = interp3(x,y,z,u,x1,y1,z1);
v1 = interp3(x,y,z,v,x1,y1,z1);
w1 = interp3(x,y,z,w,x1,y1,z1);
hold on
jj = 1:30:length(x1);
quiver3(x1(jj),y1(jj),z1(jj),u1(jj),v1(jj),w1(jj),'r')
hold off

#### 댓글 수: 2

Many thanks for your help! very efficient and straight forward!
darova 6 Apr 2020
you are welcome

로그인 to comment.

### 추가 답변(0개)

이 질문에 답변하려면 로그인을(를) 수행하십시오.

Translated by