# Error -20041 (the Input Matrix is Singular) When Setting Initial Guess Coefficient with Nonlinear Curve Fit VI

Updated Dec 20, 2017

• LabVIEW Full

## Issue Details

The "Nonlinear Curve Fit .vi" returns an error when I change the Initial Guess Coefficients. The default coefficients (2, 0, 4) work as expected. However, when I change the values to my own input, I get Error -20041. How do I set my initial guess coefficients?

## Solution

The Lev-Mar algorithm is an iterative process and depends heavily on the initial guess coefficients.
To establish a best initial guess, use the following equation:

y = a * exp(b * x) + c
1. Guess "c" by looking at the smallest data point.
2. Guess "a" by plugging the y-intercept into the equation.
3. Calculate "b" by substituting a known (x,y) point and guesses of "a" and "c" into the equation.

## Additional Information

A matrix is singular if and only if the determinant is 0. This error is likely returned due to the rounding of floating point numbers during the iterative calculation.

Not Helpful