02-12-2009 08:51 AM
Hi,
I'm a occasional LV user, and I need to fit signal using a non-linear custom model. The signal is basically an exp decay (order 1) with a DC component, so it's quite simple.
When I implement the Lev-Mar non linear fitting routine, I always got the famous "An exception occured within the external called by a Call Library Function Node. This might have corrupted LabView's memory. Save any work., etc. VIwas stopped at node " " at a call to "NI_AALPro.lvlib:Real SVD Decomposition.vi".
The thing is I already successfully fitted some basic data (linear model) using this non linear Lev-Mar fit... but it doesn't want to work this time...and I don't see why.
Could you look at my VI and model definition, and tell me what I should improve, and what might cause the problem ? The main VI (TPV_Fit_ExpDec1_v1.0.vi) initially open a text file containg my data (3 columns : time, a pulse (not usefull for fitting), the signal to fit). Initially, I isolate the portion of the signal that corresponds to t >= 0, because this is where the exponential decay starts. So I just want to fit that portion. I enclose the main VI, a txt file containing typical data, and the VI that define the model function for the lev-mark fit.
I would really appreciate your help and suggestions !
Thanks a lot in advance.
MY LABVIEW VERSION is the 8.2
JB
Solved! Go to Solution.
02-12-2009 09:38 AM - edited 02-12-2009 09:39 AM
Your main problem is the fact that you use some weird beta version (LabVIEW 8.2b23), which seems buggy. Things work just fine here.
You NEED to use an official version.
Here's a quick image on how the fit would look like. Your model can also be significantly simplified (no FOR loop, multiply A3 instead of [x] by -1, etc.).
02-12-2009 11:51 AM - edited 02-12-2009 11:52 AM
Here's a quick rewrite. You should ALWAYS graph the curve for the initial parameter estimates to see if they are in the ballpark. Instead of editing the data, you could just set the weight to zero for negatvie x. See if this works any better.
02-12-2009 01:08 PM
Thanks a lot Altenbach !!
Very efficient problem solving...
What I understand is that the LABVIEW version I use is kind of crap. However, It looks like an official version, and I got a key for that, but if it is buggy, I should really change.
Is this kind of bug well known ? Is this version unofficial do you think ?
I liked your proposition to weight the negative time data in the fit, it's really good.
I'm not familiar with all functions you added, but I'll look at it and see if I can manage.
I was just very disappointed to be unable to address my initial error, even after looking in the labview help and examples, as it seemed kind easy to implement at first.
To conclude, I'll say thank you, that was a very efficient and rapid feedback.
JB
04-28-2009 04:18 AM
So I have to develop a non linear fitting program to fit our experimental data. At frist I wasn't sure which of the instances I should use: either the vi or the string one. I decided on the vi version after looking through the previous posts made on this forum. Given that I was unsure how to select the parameters, I had a look at the vi that has been discussed in this thread and used that as template of what I might need to do.
However I have run into a problem. I get the following error:
Error -20041 occurred at NI_Gmath.lvlib:Nonlinear Curve Fit LM.vi:5
Possible reason(s):
Analysis: The system of equations cannot be solved because the input matrix is singular.
I can't work out why I am getting this error in the curve fit vi.
Also if I then continue with runnign the vi, the values in the best fit parameters now just match those in the initial fitting parameters.
The parameters I have used are fairly close to the known numbers (ie the ones I used to calculate my 'data'), and they have been selected as the default values.
Any help on this would appreciated.
I have attached 3 vi's. One is the fitting vi, another the fitting function and the third being a vi for the weight.
The function I am trying to fit is given in the fitting function vi. The equation to calculate the weight is given in the weight vi.
I should also note that the data I have attached is not from my actual experiment (hence my calling it fake data), but it is typical of the sort of data I will be getting. I have included header info in this data file as this is the style the data will come in, so to is location of the data columns (have only filled the relevant columns with data for the purposes of developing the fitting program).
I am using Labview 8.6.