stream lines for discrete data set of velocities

조회 수: 1 (최근 30일)
bharathi Dasari
bharathi Dasari 2019년 10월 18일
댓글: bharathi Dasari 2019년 10월 26일
I had a set of discrete points whose velocities are known and postions and velocities will change with time , I want to use the streamline function, but in that , the condition is that the data sets should be monotonic . Is there any way to obtain stream lines for discrete particle locations which changes with time .

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2019년 10월 18일
Your question is a bit too vague. Or rather, the input-data you have is a bit vaguely described. The answer depends on how you'll specify that input...
If you have a reasonably low number of particles and their trajectories (something like ) you could simply go for a looped version of plot3, maybe something like:
clf
hold on
E_kin = squeeze(sum(v(:,1,:).^2,3));
g = (E_kin-min(E_kin))/(max(E_kin)-min(E_kin));
r = (r(:,1,1)-min(r(:,1,1)))/(max(r(:,1,1))-min(r(:,1,1)));
b = (r(:,1,2)-min(r(:,1,2)))/(max(r(:,1,2))-min(r(:,1,2)));
for i1 = num_particles:-1:1
ph(i1) = plot3(r(i1,:,1),r(i1,:,2),r(i1,:,3));
set(ph(i1),'color',[r(i1),g(i1),b(i1)])
end
That would plot the trajectories of all your particles in 3-D with the trajectories coloured according to their
initial x-y position (red and blue), and initial kinetic energy (green).
On the other hand that seems like such an obvious solution, so you might such a large number of particles that this doesnt work. For that perhaps you can use local averaged velocities, but that would involve a lot of looping:
for each time-step for each sub-volume, find all all particles inside, calculate their average velocity, when done with all subvolumes, you should be able to use streamline3, then on to next time-step
HTH
  댓글 수: 6
Bjorn Gustavsson
Bjorn Gustavsson 2019년 10월 26일
If your nans on the edges of the grid this might be because of a "simple" reason: the griddata (and the triscatteredinterp-functions (TriScatteredinterp, scatteredinterp, etc)) typically returns interpolated values inside the convex hull of the points you have data at - outside of that region (area in 2-D, volume in 3-D) it would be an extrapolation. You can test different interpolation-methods and some of the functions allow you to explicitly chose extrapolation methods.
How to handle extrapolation in the general case I dont know.
As far as I understand these methods should not return nan inside the convex hull - unless you have a nan in the input-data.
HTH
bharathi Dasari
bharathi Dasari 2019년 10월 26일
I don't have any data saying as nan ,my velocity values are small

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

추가 답변 (0개)

카테고리

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