title: Create a "pyramid" matrix
body: <p>Say I'm given a symmetric row vector with an odd length where each element is smaller than the next one in the first half of the vector and each element is bigger than the next one in the second half and the middle element is the biggest. (e.g <code>[1 2 3 2 1]</code> or <code>[10 20 50 20 10]</code>). </p>
  
  <p>I want to create a square matrix where this row vector is its middle row and the equivalent column vector (<code>v'</code>) is its middle column and each other row or column is a reduced version of the given vector according to the middle element in this row or column. And when there are no more "original elements" we put <code>0</code>. </p>
  
  <p>Examples: </p>
  
  <p>if <code>v = [1 2 3 2 1]</code> we get</p>
  
  <pre><code>0 0 1 0 0  
  0 1 2 1 0  
  1 2 3 2 1  
  0 1 2 1 0  
  0 0 1 0 0
  </code></pre>
  
  <p>if <code>v = [3 5 3]</code> we get</p>
  
  <pre><code>0 3 0  
  3 5 3  
  0 3 0  
  </code></pre>
  
  <p>What I did so far: I managed to create a matrix with <code>v</code> as the middle row and <code>v'</code> as the middle column with this code I wrote:</p>
  
  <pre><code>s = length(vector);
  matrix= zeros(s);
  matrix(round(s/2),:) = vector;
  matrix(:, round(s/2)) = vector';
  </code></pre>
  
  <p>but got stuck with assigning the other values.</p>