
Re: Trouble using polyfit that separated straight fit from original data points
Posted:
Nov 4, 2013 7:59 AM


> Hi all, > > Thought I might post here too. > > I am plotting some data from a powerinverse law and > using the following: > > loglog(E2dist,E2PrdB,'+g'), hold on > > p = polyfit(log(E2dist),log(E2PrdB),1); > > m = p(1); > > b = exp(p(2)); > > %mean=mu(1); > > %std=mu(2); > > loglog(E2dist, b.*E2dist.^m,'m*'); > > This works fine. But when I change the polyfit line > to > > [p,S,mu] = polyfit(log(E2dist),log(E2PrdB),1); > > so that I can get standard deviation etc. my straight > line fit is moved vertically up from my original data > points? I notice that the log of my first dist point > 1m is coverted to 0. Not sure if that would move it > and how to correct it. > > Hope you can help. > > cheers
Did you notice that when you call polyfit as [p,S,mu] = polyfit(log(E2dist),log(E2PrdB),1); the resulting regression polynomial will be a function of x^= (xmu)/sigma instead of x ?
Best wishes Torsten.

