[scilab-Users] finding polynomials of best fit
michael.baudin at scilab.org
michael.baudin at scilab.org
Sat Aug 27 14:35:22 CEST 2011
Hi,
It's really easy to use the backslash operator to find the least
squares solution of a system of linear equations. In this case, the
solution is the set of coefficients of the polynomial.
Another option is to use a dedicated function. There is no one in
Scilab, but there are several toolboxes to do this.
The Stixbox toolbox (http://atoms.scilab.org/toolboxes/stixbox) has
three functions:
* linreg : Linear or polynomial regression
* polyfit : Polynomial curve fitting
* polyval : Polynomial evaluation
The fitters toolbox (http://atoms.scilab.org/toolboxes/fitters) also
has dedicated functions.
Regards,
Michaël
On Tue, 16 Aug 2011 10:50:09 -0400 (EDT), beemc2 at aol.com wrote:
> I'm a first-year engineering student working with a professor on
> stereoscopic cameras, and one of my assignments is to determine lens
> distortion in the cameras and put together an algorithm to correct
> it.
> My basic plan is take photos of a known grid of dots and put together
> a list of their actual positions and their positions as they appear
> in
> the image, the use some form of statistical regression technique to
> give myself a good approximation of the radial distortion as a
> function of distance from the center. (a perfect camera with no
> distortion should give a linear relation between the real position
> and
> the position in the image.) Since I don't have much information on
> the geometry of the lenses themselves, i can't solve the problem
> analytically. I want to just get the function as a fourth- or
> fifth-degree Taylor polynomial (I'm told that the fourth term is the
> highest one that will likely be significant).
> So is there a decent function in Scilab that will allow me to find a
> polynomial of best fit for a given set of data? There's something
> similar in Excel but I'd rather not have to go through the hassle of
> exporting and then re-importing the the data, and I also might need
> it
> later for other applications.
> YMW
More information about the users
mailing list