I have the following function:
$$M = a(\log_{10}W-2.5)+b$$
I also have a set of data with actual measured values of $W$ and $M$ (each have individual $\pm$ errors). Here's a small sampling of the data:
W(x) M(y) M_model
245 -19.59 -19.05
155 -16.64 -17.76
314 -20.26 -19.75
351 -20.78 -20.07
192 -17.96 -18.37
... ... ...
Using $W$ and $M$ values from the dataset, I did a non-linear least squares fit (using Matlab's optimtool)and a $y = ax + b$ form where $x = \log_{10}(W)-2.5$. Found values of $a$ and $b$, and then calculated $M_{model}$ in the table above.
$$a = -6.359$$ $$b = -19.83$$
How do I find what uncertainty there might be in $a$ (slope) and $b$ (intercept)? I need the function in the format:
$$M = (-6.359\pm c)(\log_{10}W-2.5)+(-19.83\pm d)$$
Update I have tried using LINEST() in Excel which provides me with the errors, but it also provides me with slightly different $a$ and $b$ values too. Is there a more robust way of calculating these uncertainties?
Update I have tried Michael's solution below, and that gives me one figure, substituting his $x$ for my $M$. I think that gives me the $\pm slope$, but I am not sure if that is correct. Also not sure how to get $\pm intercept$ as I only have one set of residuals (for $M$).