title: MATLAB - Plotting a smooth volume from 3D scatter plot data
body: <p>So I have data in the form [x y z intensity] that I plot on a scatter3 figure with xyz axes. The colour of the data is used to dictate the intensity value. Problem is, using a scatter plot means the data points show up as discrete points. What I need, is a smooth shape - so I guess I need some kind of interpolation between the points? </p>
  
  <p>I've tried using trisurf, but the problem with this one is that it interpolates between points that it shouldn't. So where I should have 'gaps' in my surface, it joins up the edges instead so it fills in the gaps. See the attached pics for clarification.</p>
  
  <p>Does anyone have any suggestions?</p>
  
  <p>The code I use is as below (the commented out scatter3 is what does the scatter plot, the rest does the trisurf):</p>
  
  <pre><code>% Read in data
  dataM = csvread('3dDispersion.csv');
  
  % scatter3(dataM(:,1), dataM(:,2), dataM(:,3), 5, dataM(:,4),'filled');
  
  % Plot
  hold on;
  x = dataM(:,1);
  y = dataM(:,2);
  freq = dataM(:,3);
  tri = delaunay(x,y);
  h = trisurf(tri, x, y, freq);
  
  % Make it pretty
  % view(-45,30);
  view(3);
  axis vis3d;
  lighting phong;
  shading interp;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/EzkKy.png" alt="The scatter plot"></p>
  
  <p><img src="https://i.stack.imgur.com/YxSUh.png" alt="The trisurf plot"></p>