Calculation of streamline length (Line object)
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!