weighted fit to log-log data

4 views (last 30 days)
Ben
Ben on 13 Jan 2014
Commented: Ben on 15 Jan 2014
Hi, I need to perform a first order log-log fit with the ability to weight the samples. This should fit a straight line through data plotted on log-log paper. My code seems right to me but the results are wrong. Can any one set me straight?
x = independand data
y = dependant data
w = weighting scheme
d = lscov( [ones(size(x')) log10(x)'] ,log10(y)',w)
%if i plot this the fit line is out by a factor of ~10^3
loglog(10.^x,10.^y,'o',10.^[.2,.5],10^(d(1)).*10.^([.2,.5]*d(2)),'-')
  1 Comment
Ben
Ben on 15 Jan 2014
Further to this, it seems to me that lscov is correct but my plotting is incorrect. This seems closer, but still incorrect:
loglog(x,y,'o',[.2,.5],10^(d(1))*10.^(d(2)*[.2,.5]),'-')
Any ideas where I'm going wrong?

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!