07-12-2023 11:47 AM
Hi,
I am trying to fit some data using a Python code and the nonlinear fitting function, but it is returning Error 20041, stating that the matrix is singular. Can anyone help me identify the problem with what I've put together? I'm using values in the hundreds for my initial guess, which is temporarily and unhelpfully labelled as "Array".
The data comes from the "Wavelength," "Reflection," "Light ref," and "dark ref" files and should be imported in that order. I'll also attach the Python code and a screenshot of the exact error. The Separated Fitting VI takes in the data and does the fitting.
This error seems to keep popping up in several different nonlinear fitting attempts I've made.
Solved! Go to Solution.
07-12-2023 05:43 PM
You are just digging yourself a bigger hole (after this attempt).
I recommend to start with some very basic tutorials. I doubt you need python for the model.
07-13-2023 10:18 AM
Thank you for pointing out that my X and Y were different sizes. Accessing Python was actually a better tool for me because I wrote the Python model before I even started with LabVIEW and the equation is huge, so I wasn't really digging myself a deeper hole.
The fix was very simple. Since the Python node requires the type of output expected to be wired to the "return type" input, I wrongly assumed that all other inputs wired needed to be the same type and was wiring the whole "a" array. I tried just indexing the array and wiring the first value as my "a" input instead, and it took it. No more singular matrix error.