How to extend the line of best fit (polyfit) to cross the y-axis at zero in MATLAB
<p>In MATLAB, I want to plot scatter data with a regression. </p>

<pre><code>a = [2004.4 2005.6 2002.1 2002.1 2004.8 2002.6 2003.5 2001.3 2003.5 2002.6];
b = [0.1006 0.0848 0.0502 0.0502 0.0909 0.0385 0.0732 0.0732 0.0896 0.0772];
scatter(a, b, 6);
hold on
p = polyfit(a,b,1);
f = polyval(p,a);
plot(a,f,'Color',[0.7500    0.7500    0.7500],'linewidth',1.5)
</code></pre>

<p>However, I want to extend the line (and the x-axis) so that the line goes through <code>y=0</code> and crosses the x-axis at its origin wherever that is, so that it looks something like this:</p>

<p><a href="https://i.stack.imgur.com/F3CCu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F3CCu.png" alt="enter image description here"></a></p>