title: 2D Kernel Density Estimate in Matlab
body: <p>I am using <a href="http://au.mathworks.com/matlabcentral/fileexchange/17204-kernel-density-estimation/content/kde2d.m" rel="nofollow noreferrer">this</a> function to estimate kernel density in 2D. I am slightly confused by the parameters of this function however.</p>
  <p>Here is an example, viewed from directly above, where density is being calculated at each point (O) in the figure. i.e: over very small areas.</p>
  <p><a href="https://i.stack.imgur.com/qrmkx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qrmkx.png" alt="density test" /></a></p>
  <p>I want to change the KDE function parameters so that density is computed over a larger area (for example, the area circled in red). Which parameters do I need to change? I presume it is one (or both) of these:</p>
  <p>&quot;n: size of the n by n grid over which the density is computed (default 2^8)&quot;</p>
  <p>OR:</p>
  <p>&quot;MIN_XY, MAX_XY: limits of the bounding box over which the density is computed&quot;. The default limits are computed as:</p>
  <pre><code>MAX = max(data,[],1); 
  MIN = min(data,[],1); 
  Range = MAX-MIN; 
  MAX_XY = MAX+Range/4; 
  MIN_XY = MIN-Range/4;
  </code></pre>