Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Trouble using polyfit that separated straight fit from original
data points

Replies: 1   Last Post: Nov 4, 2013 7:59 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Torsten Hennig

Posts: 2,419
Registered: 12/6/04
Re: Trouble using polyfit that separated straight fit from original
data points

Posted: Nov 4, 2013 7:59 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

> Hi all,
>
> Thought I might post here too.
>
> I am plotting some data from a power-inverse 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^= (x-mu)/sigma instead of x ?

Best wishes
Torsten.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.