01-25-2014 02:01 PM - edited 01-25-2014 02:04 PM
Hi everyone,
I have very little experience with LabVIEW and I'm trying for the first time to do some NonLinear Curve fit for some data I have.
I've searched in forums for almost a day and couldn't find what I need. The problems are:
1) I need to fit a function of the following type: P = Po/2 - Po/2*erf(sqrt(2)*(x-xo)/w) , where Po, xo and w are my parameters.
But in my error2.vi I cannot link my y=sqrt(2)*(x-xo)/w variable of the erf function to the input, because the erf.vi does not accept 1D array as input and doesn't give that as output as well. The output thing is another problem, since the input of F(x,a) needs to be a 1D array.
2) I read about the Lev-Mar NonLinear CurveFit VI and I think I got what needs to be done. However, a I was having problems in wiring my Static VI Reference to the F(x,a) input in the Lev-Mar VI and it didn't give me a broken wire only when I made de Reference a "Strictly Typed VI Reference". What does that mean? Why did it only work with that?
I know these are some pretty basic doubts, but I've been trying to understand it for quite some time and couldn't get this done.
Thanks.
PS* The fitting function (subvi) is the error2.vi file.
Solved! Go to Solution.
01-25-2014 02:31 PM - edited 01-25-2014 02:34 PM
For the model, you need to start with the template mentioned in the help page (seems you did that). The model needs to be strictly typed, because the model subVI needs to match the required connector pattern exactly.
01-25-2014 02:59 PM
Thanks!
And do you know anything about the use of "Error Function"? I found only a few references to it in the web and I don't understand how to make it work...
01-25-2014 03:03 PM - edited 01-25-2014 03:05 PM
Try this. Seem to work just fine (LabVIEW 2013).
(don't try to graph the best parameters, graph the best fit output!)
01-25-2014 03:13 PM - edited 05-30-2014 06:25 PM
@Yuri94 wrote:
And do you know anything about the use of "Error Function"?
The LabVIEW version is not polymorphic, i.e. it does not accept arrays, but only single x values. This means you simply need to wrap an autoindexing FOR loop around it to do it for all x values.
01-25-2014 04:14 PM
Wow! Thanks so much, altenbach! It works perfectly!
I didn't know about the "Re/Im to Complex" for plotting graphs. Very useful... Thanks a lot!
01-25-2014 04:24 PM
I am glad it works for you. Feel free to mark the most helpful answer as solution to the thread. 😄
11-27-2014 07:18 AM
Hello,
I have the same problem with the fitting of the error function. I tried to open the vi's, but I'm using Labview 2011. So it's not possible to open them. Is it possible to upload the vi's for Labview2011 again? This would be great.
Thanks!
Andreas
11-27-2014 10:19 AM
@Andreas_B wrote:
Is it possible to upload the vi's for Labview2011 again? This would be great.
Here you go!