필터 지우기
필터 지우기

Calculation of streamline length (Line object)

조회 수: 4 (최근 30일)
Kilian Thomas
Kilian Thomas 2014년 8월 26일
Hi everybody,
I explain you my problem : Given a matrix of density current (Jx,Jy), I want to calculate the distance of the streamline for each point of my matrix. To do so, I already write the following code :
for i=1:ny
for j=1:nx
h=streamline(X,Y,Jx,Jy,(j-1)*dx,(i-1)*dy);
distanceCurrent(i,j)=sum(sqrt(diff(get(h,'Xdata')).^2+diff(get(h,'Ydata')).^2));
end
end
Where, dx dy are the gridstep and nx ny the number of point. This works well but it takes a lot of time. To improve the running time, I wanted to do the following :
H=streamline(X,Y,Jx,Jy,X,Y)
which gives me an array of line objects. But I cannot do the same as before because get(H(i),'Xdata') for all i returns 0.
Do you have any idea to improve my code or another way to calculate the length of a streamline?
Thank you very much

답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by