2 dimensional error and polyfitting

Ben Abbott bpabbott at mac.com
Mon Mar 17 11:20:32 CDT 2008


On Monday, March 17, 2008, at 11:03AM, "Kyndig" <chris at pakkala.name> wrote:
>
>Could someone please advise me on how to accomplish what wpolyfit does but
>with an error input for the x values as well as y.  In other words,
>currently wpolyfit only accepts a "dy" argument.  I'd like to input a "dx"
>also.  Can this be done?  Thank you for your time.
>-- 
>View this message in context: http://www.nabble.com/2-dimensional-error-and-polyfitting-tp16075563p16075563.html
>Sent from the Octave - General mailing list archive at Nabble.com.
>

I don't know what your application is, but if the slope of the resulting polynomial fit is not terribly sensitive to changed to dx and/or dy, you might try an approach like the one below

function [p, s, mu] = wpolyfitdxdy (x, y, dx, dy, N)
  p = wpolyfit (x, y, dy, N);
  dydx = polyval (polyder (p, x));
  dy = dy + dydx.*dx;
  [p, s, mu] = wpolyfit (x, y, dy, N);
endfunction

Ben


More information about the Help-octave mailing list