From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-07-2014 03:48 PM
Sorry my bad...
Here is the model file.
04-07-2014 04:07 PM - edited 04-07-2014 04:40 PM
Well, the curve calculated from your initial estimates does not resembele th datya at all. You need to finid paramtere guesses that are more reasonable.
Here's a quick rewrite of the caller and model. I included plotting the curve for the initial estimates. You figure it out. 😉
04-10-2014 09:59 AM
Thank you. It looks like the nonlinear curve fit vi is not capable of optimizing fit parameters for a complicated fit function like in my case. I could start with a fairly close initial parameter set that I got from Matlab optimization. With a fractional value change and inputing them to LabVIEW, the curve fitting result is either with fit parameters far away from the optimal or a failure that shows no optimal. Instead, if I change that to constrained nonlinear curve fit vi, the fitting result is very promising if I set the parameter boundary carefully. Have you seen such difference before? I would like to know if there is a better way to do this kind of curve fitting for nonlinear curve.
04-10-2014 10:32 AM
Can you share the best fit parameters obtained using Matlab?
-Jim
04-10-2014 10:33 AM
@stevensung wrote:
Thank you. It looks like the nonlinear curve fit vi is not capable of optimizing fit parameters for a complicated fit function like in my case.
I am using the nonlinear fit with models that are orders of magnitudes more complicated than that, so that's not the problem.
You model might be ill posed or poorly scaled and it might help to transform the data. Have you tried e.g. fitting the log of x and y and adjust the model accordingly.
Please show us what kind of initial parameters generate a curve that looks similar to the data.
Please show us your latest code. Are you sure that all parameters are uncorrelated?
04-10-2014 10:43 AM
First of all, the model function is taken from my control engineering colleague so I have no doubt about its accuracy. They have perfomed quite lot of such nonlinear curve fitting other programs such as Matlab in the past and have not seen any issue. What I am tring to work on is to demonstrate the simiar capability of LabVIEW for such a curve fitting task. And I beleve with some tweaking we should be able to at least get the same result that people with other programs have reached so far. For this particular nonlinear curve fitting, with the raw data that I attached before, the optimal fitting parameter set obtained with Matlab is {A=5.0915, B=0.0000, C=1.000, p=1.9929, Min_Pickup=92}. And these parameters are not correlated as I know. I hope we could get to this with LabVIEW, with help from you guys.
Thanks.
04-10-2014 10:50 AM
That problem is that with these initial paramters, the curve does not look at all like the data. Something is wrong in the model. Are you sure all the parts are correct? Can you link to a website that described the model in detail?
Once the model is corrected so the model calculation with these parameters looks like the data, we should be in business. Obviously, there is an error in the current model, that's all.
04-10-2014 02:14 PM - edited 04-10-2014 02:15 PM
Just playing around, using A/((x/I)^(p-C))+B instead gives a somewhat more reasonable curve (but C and p are of course 100% correlated now. Still, the fit succeeds!).
We really need a reliable reference for the correct model description to get it to work as expected.
04-10-2014 02:18 PM - edited 04-10-2014 02:19 PM
Hi Altenbach,
Thank you for your response in such a long chain. I modified my LV code to present the resulting fitting curves together with raw data and that with the initial fit parameters. As could be seen from the attached graph the initial fit parameters fit very well but the curve with output from the fitting function is far away from that of raw data. And that is with the Contrained Nonlinear Curve Fit VI. When I switch the called function to Nonlinear Curve Fit VI the situation becomes worse. If you try to play my LV code as attached you will see with that fit function the result is either worse or comes with a "No optimal value" error. And I believe that is what I have to figure out to solve this problem.
I hope this time I have provided enough information for you to help me out.
Please let me know if something is still missing.
04-10-2014 02:19 PM - edited 04-10-2014 02:20 PM
Please don't attach two different zip files with the same name.
EDIT: Ahh you corrected it!