title: matrix of exponentially declining values according to a given vector
body: <p>I have a vector of solar radiation measurements for a water body, I would like to calculate the radiation that reaches certain depths in the water column. This can be calculated from Beer's law, which I have applied for the second depth of my measurements:</p>
  
  <pre><code>rad = 1+(30-1).*rand(365,1);
  depth = 1:10;
  
  kz = 0.4;
  rad(:,2) = rad(:,1).*exp(-kz.*depth(2));
  </code></pre>
  
  <p>How would I apply this to all of the depths specified in the vector 'depth'? i.e. how would I generate a matrix which has 365 rows and 10 columns where each column refers to the radiation that reaches that particular depth. </p>