title: How do I find the slope (rate) in MATLAB?
body: <p>How do I find the slope (rate) in MATLAB? </p>
  
  <p>For example, say I have a scatter plot:</p>
  
  <pre><code>Year = [2001 2002 2003 2004 2005];
  Distance = [1.5 1.8 1.9 2.2 2.5];
  scatter(Year, Distance)
  hold on
  pf = polyfit(Year,Distance,1);
  f = polyval(pf,Year);
  plot(Year,f)
  </code></pre>
  
  <p>And I can find R by:</p>
  
  <pre><code>[r,p] = corrcoef(Year,Distance)
  </code></pre>
  
  <p>I want to find the rate at which the distance increases per year, which I think is equivalent to the slope? </p>