LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lev-Mar does fit but says I have a singularity?

My Levenberg-Marquardt fit seems to work OK on this data set, and yet I still see the following error when I run the program:

"The system of equations cannot be solved because the input matrix is singular."

Also, the VI says my mean-squared error is on the order of 10^6.

What am I doing wrong?
-Stefano
Download All
0 Kudos
Message 1 of 5
(3,004 Views)
Your model only uses four parameters, but you feed it 8 parameters. (resize the "initial guess" control to see)!
 
You need to make sure that it only contains 4 elements. Just hiding them by making the array container smaller does not help ;).
 
Basically what happens. The fit proceeds fine, because the unused parameters always have a zero partial derivative and they are considered converged from the beginning. The only problem is the matrix inversion for the covariance matrix output. It cannot be inverted because it contains multiple rows and columns with zeroes
 
Also make sure to NOT use "insert into array" to programmatically modify an initial estimate. Use "replace array element" else you change the number of parameters again.
 
The attached seems to work just fine. See if it helps.
 
 

Message Edited by altenbach on 01-05-2006 09:11 AM

0 Kudos
Message 2 of 5
(2,996 Views)


@TheInfamousYano wrote:
Also, the VI says my mean-squared error is on the order of 10^6.


This is because you wire a stdev of 1e-6, which causes a different weighting (the MSE is weighted by the stdev, look at the chisquare subVI (XX.vi). This makes sense: Your final solution is still way outside 1e-6 of the data, right! 😉
 
Change the stdev back to 1 (or simply leave it unwired), your fit will converge fine (the stdev is not a problem as originally thought with your earlier post).
 
With a stdev=1, the MSE=5.013E-6 😄
Message 3 of 5
(2,989 Views)
ah you are a good man, thank you sir
0 Kudos
Message 4 of 5
(2,983 Views)
So now I want to use 6 Lev-Mar fitting parameters instead of the original 4. I added the 2 new parameters to the fitting function and gave them initial guesses, but for some reason the original four become static. The program simply returns the initial guesses for the first four instead of trying to achieve the fit. Ideas?

"VApprox.vi" is the main program. Sample data attached.

Thanks
-Stefano
Download All
0 Kudos
Message 5 of 5
(2,942 Views)