It is not always easy to find an acurat fit in an polynominal 3th order. Because in the software of Mosc007 the calibration is outside (not in the device, there it is in a file) it is possible do modify the calculation to an 5th or more order (if you write a software your own like Mosc007, great job).
I am using my calibration of the device only for orientation and make it more acurat in a postcalculation, because there is a need of this in the application i am using this.
This got me thinking and so I went back to the code. The VB6 code I converted to C# lets you specify the polynomial order you want to calculate for. Since we've been talking about 3rd order polynomials I've just been passing in the number 3 for that parameter.
Here is the function
Code:
public static double[] FindPolynomialLeastSquaresFit(double[] PtX, double[] PtY, int degree)
And, here is how I'm calling that function.
Code:
cNums = LeastSquaresSimple.FindPolynomialLeastSquaresFit(pixels, wavelengths, 3);
This function would allow you to calculate nth polynomial orders and pass in nth number of points.
If I pass in 3 for degrees, I get 3 numbers back, if I pass in 4 for degrees, I get back 4 numbers. Spectrum Studio allows for nth number of points but only calculates 3 degrees.
Not sure if that is usefull but I thought I'd share