[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: polyfit questions

From: Georg P. Israel
Subject: RE: polyfit questions
Date: Thu, 27 Jul 2006 10:02:06 +0200

Dear Frank,

please look into the attachment.
It is a badly documented peace of octave code ;-).

Now some explanations to the function.
I try to do some some geometric lens distortion correction.
In this process, I do need to have a function that calculates the
relative distortion in function to the distance to the distortion
centre. This is r^2 = x^2 + y^2. Because the square root function is to
expensive, I do have to define the correction polynom as a function of
Hence, my correction function is f(r) = polyval(a,r^2).
I have been able to find nice parameters "a" such that the distortion is
However, for test, I like to find the inverse function that can use the
same infrastructure.

Best regards


On Wed, 2006-07-26 at 15:16 -0400, Frank Palazzolo wrote:
> Ok, why are you using f = x .* polyval(...) instead of f = polyval(...)?
> I tried doing this problem 2 ways myself, but the success of the
> least-squares fit to the inverse seems very dependant on the actual
> polynomial "a" used.  Can you give us an "a" vector which you believe has an
> inverse in that form?
> Thanks,
> Frank
> -----Original Message-----
> From: address@hidden [mailto:address@hidden
> On Behalf Of Georg P. Israel
> Sent: Tuesday, July 25, 2006 11:37 AM
> To: address@hidden
> Subject: polyfit questions
> Dear Octave users,
> it seems that polyfit does not work for me.
> This is not a software issue, but it seems that I overlook some mathematical
> issues.
> I do have a function of the form of a polynome:
> f(x)= a0+a1*x^1+...+a6*x^6
> The function gets called with x:= X^2
> Hence, the actual function is of the order of 13 with all odd elements zero.
> I like to find the inverse function to this function such that:
> g(f(x)) = x
> g(y) should be notated in the same form as f(x).
> If I try to do this with a normal polynome where x:=X then the fitting works
> fine. But when I try to do the same with x:=X^2 then this stuff fails
> misserably. This means, the resulting approximated polynome is very much
> different form the original.
> Do I overlook something??
> To be more specific:
> x = [0:1:215];
> f(x) = x .* polyval(a,x.^2);
> now, I tried to find the g(y) that has the same form of a polynome as
> f(x) but approximates the inverse of this function.
> If I define f(x) = x .* polyval(a,x); and it's inverse similar then all
> works fine. But if I use a power of two then all fails.
> Has anybody an idea how to define this ???
> Looking very much forward reading about some nice suggestions.
> Georg P. Israel
> <info at>
> _______________________________________________
> Help-octave mailing list
> address@hidden

Attachment: cmv_fit.m
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]