title: How to analyze and visualize a 3D velocity field?
body: <p>I am trying to use the best practice techniques in the <a href="https://en.wikipedia.org/wiki/Computational_fluid_dynamics" rel="nofollow noreferrer">Computational fluid dynamics</a> area to analyze and visualize a <a href="https://en.wikipedia.org/wiki/Vector_field" rel="nofollow noreferrer">velocity field</a>.</p>
  
  <p>Given 6 arrays of moving particles' positions and velocities: <code>x,y,z</code> and <code>vx,vy,vz</code> respectively.</p>
  
  <p>I want to visualize and calculate the induced velocity field and its properties such as: <a href="https://en.wikipedia.org/wiki/Curl_(mathematics)" rel="nofollow noreferrer">curl</a>, <a href="https://en.wikipedia.org/wiki/Divergence" rel="nofollow noreferrer">divergence</a>, <a href="https://en.wikipedia.org/wiki/Isosurface" rel="nofollow noreferrer">isosurfaces</a> etc.</p>
  
  <p>Here is a modest script of the <a href="https://www.mathworks.com/videos/series/volume-visualization-98092.html" rel="nofollow noreferrer">volume visualization</a> functions I was able to use without calling <code>meshgrid</code> (to avoid interpolation and more noise).</p>
  
  <p>Ultimately, one of the things that I am not sure about is how to wisely create a mesh grid from my 50 points in space, the second is how to use CFD approaches to visualize the velocity field regardless the small amount of data points. </p>
  
  <pre><code>close all
  rng default
  t=0.1:0.1:10;
  x = sin(t)'; 
  y = cos(t)'; 
  z = t.^0.2';
  vx=y;vy=x;vz=z;
  
  figure
  subplot(2,3,1);
  quiver3(x,y,z,vx,vy,vz);
  hold on
  streamribbon({ [x y z] }, {vx},{vy},{vz});
  
  subplot(2,3,2);
  [curl_val, cav] = curl([x,y,z],[vx,vy,vz]);  
  surfc([x,y,z],cav);
  subplot(2,3,3);
  surfc([x,y,z],curl_val);
  
  w = sqrt( vx.^2 + vy.^2 + vz.^2 );
  subplot(2,3,4);
  quiver3(x,y,z,vx,vy,vz);
  streamtube({ [x y z] }, {w});
  
  subplot(2,3,5);
  quiver3(x,y,z,vx,vy,vz);
  
  subplot(2,3,6);
  surfc([x,y,z],[vx,vy,vz]);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/CZ9q4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CZ9q4.png" alt="enter image description here"></a></p>
  
  <p>When I run the above script (excluding the data generation) on a <a href="http://pastebin.com/raw/6Werdnpf" rel="nofollow noreferrer">real data</a>, I get the following plots which aren't very informative:</p>
  
  <p><a href="https://i.stack.imgur.com/4STmg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4STmg.png" alt="enter image description here"></a></p>