Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
Software
»
comp.softsys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
Trouble using polyfit that separated straight fit from original data points
Replies:
1
Last Post:
Nov 4, 2013 7:59 AM




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.



