I have the 2-D PIV data like below and I am not able to get streamlines in matlab:
ix,iy,iz = image coordinate X,Y,Z [pixel]
dx = displacement component X [pixel] * (image resoltion) = mm
dy = displacement component Y [pixel] * (image resoltion) = mm
--------------------------------------------------
So I have dx and dy in mm. Also I can calculate: du = dx/dt , dv = dy/dt as the velocities in x and y directions.
I want to get the streamline usnig streamline/streamslice functions in matlab but I do not know how to define startx and starty?? Should I use meshgrid function for that? and shoul I use ix,iy(image coordinates) OR dx,dy to define startx and starty points?
Moreover do I need to define meshgrid for du,dv to fill velocities for every point??
Any help would be appreciated.
A = xlsread(......myfile.xls); % myfile.xls contains all data.
dx = A(1:end,4); % size(dx) = 8400*1
dy = A(1:end,5); % size(dy) = 8400*1
du = A(1:end,6); % size(du) = 8400*1
dv = A(1:end,7); % size(dv) = 8400*1
[startx,starty] = ?????
[X,Y] = meshgrid(dx,dy);
streamline(X,Y,du,dy,startx,starty);

댓글 수: 1

Ham Man
Ham Man 2021년 7월 16일
The streamline/streamslice gave me an error stating that U,V should be 3D data. How can I make those in 3D?

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

 채택된 답변

KSSV
KSSV 2021년 7월 14일
편집: KSSV 2021년 7월 14일

2 개 추천

Try:
skip = 2 ; % can be changed
startx = X(1:skip:end,1:skip:end) ;
starty = Y(1:skip:end,1:skip:end) ;
streamline(X,Y,du,dy,startx,starty);
Also have a look on streamslice. This would be a better function to use.

댓글 수: 11

Ham Man
Ham Man 2021년 7월 14일
편집: Ham Man 2021년 7월 14일
Thanks for replying KSSV.
It gave me an error for the size of du and dv. Shouldn't be du and dv in the same size of X,Y? X and Y are now a grid but du,dv are both have one column.
size(X) = size(Y) = 8400*8400
size(du) = size(dv) = 8400*1
Ham Man
Ham Man 2021년 7월 14일
Is this true for input argument for "streamline" function:
streamline(x displacement,y displacement,velocity in x direction,velocity in y direction)??
KSSV
KSSV 2021년 7월 15일
(x,y) are locations at which you have velocitties (u,v). If you don't have locations you can plot w.r.t indices.
Ham Man
Ham Man 2021년 7월 16일
The streamline/streamslice gave me an error stating that U,V should be 3D data. How can I make those in 3D?
KSSV
KSSV 2021년 7월 17일
Share your data.
Ham Man
Ham Man 2021년 7월 17일
편집: Ham Man 2021년 7월 17일
Here is my data. Thanks for your attempt.
ERROR:
Error using streamslice (line 142)
Volume data arguments must be 3-D arrays.
Ham Man
Ham Man 2021년 7월 18일
편집: Ham Man 2021년 7월 18일
I wonder how to make du,dv in the same size of X,Y? should I use reshape or repmat to make du and dv in the same size of X,Y( made by meshgrid(dx,dy) )?
otherwise the streamline are not achievable.
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/687023/ane1_data.xlsx.xlsx') ;
T(8447,:) =[] ; % remove NaNs
x = T.(1) ; y = T.(2) ;
dx = T.(4) ; dy = T.(5) ;
[X,Y] = meshgrid(linspace(min(x),max(x)),linspace(min(y),max(y))) ;
dX = griddata(x,y,dx,X,Y) ;
dY = griddata(x,y,dy,X,Y) ;
streamslice(X,Y,dX,dY)
Ham Man
Ham Man 2021년 7월 19일
Awesome, Many thank to you. This is what I was looking for. Much appreciate.
I tried "streamline" function but no luck. How does it work with these data?
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/687023/ane1_data.xlsx.xlsx') ;
T(8447,:) =[] ; % remove NaNs
x = T.(1) ; y = T.(2) ;
dx = T.(4) ; dy = T.(5) ;
[X,Y] = meshgrid(linspace(min(x),max(x)),linspace(min(y),max(y))) ;
dX = griddata(x,y,dx,X,Y) ;
dY = griddata(x,y,dy,X,Y) ;
streamline(X,Y,dX,dY,X,Y)
And thanks is accepting/ voting the answer.
Ham Man
Ham Man 2021년 7월 19일
편집: Ham Man 2021년 7월 19일
Perfect. Thanks again KSSV.

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

추가 답변 (0개)

카테고리

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

질문:

2021년 7월 14일

편집:

2021년 7월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by