title: What is the algorithm used to interpolate in Matlab's imresize function?
body: <p>I am using the Matlab/Octave <code>imresize()</code> function which resamples a given 2D array. I want to understand how a particular interpolation algorithm used in <code>imresize</code> works.</p>
  
  <p>(I am using octave on windows)</p>
  
  <p>e.g.</p>
  
  <pre><code>A =  1 2 
       3 4
  </code></pre>
  
  <p>is a 2D array. Then I use the command</p>
  
  <pre><code>b=imresize(a,2,'linear'); 
  </code></pre>
  
  <p>basically upsampling row and columns by 2.</p>
  
  <p>The output is </p>
  
  <pre><code>1.0000   1.3333   1.6667   2.0000
  1.6667   2.0000   2.3333   2.6667
  2.3333   2.6667   3.0000   3.3333
  3.0000   3.3333   3.6667   4.0000
  </code></pre>
  
  <p>I don't understand how this linear interpolation is working. It is said to use <strike>bi</strike>linear interpolation, but how does it pad the data at boundaries and how does it get the output that it is getting?</p>
  
  <p>Second example: 
  For </p>
  
  <pre><code>A = 
  
  1   2   3   4
  5   6   7   8
  0   1   2   3
  1   2   3   4
  </code></pre>
  
  <p>how does <code>imresize(a,1.5,'linear')</code> give the following output?</p>
  
  <pre><code>1.00000   1.60000   2.20000   2.80000   3.40000   4.00000
  3.40000   4.00000   4.60000   5.20000   5.80000   6.40000
  4.00000   4.60000   5.20000   5.80000   6.40000   7.00000
  1.00000   1.60000   2.20000   2.80000   3.40000   4.00000
  0.40000   1.00000   1.60000   2.20000   2.80000   3.40000
  1.00000   1.60000   2.20000   2.80000   3.40000   4.00000
  </code></pre>