04-07-2014 11:55 AM
My question is about fitting a curve with nonlinear curve fit VI. The fitting function has the formula like
A/((x/I)^p-C)+B, where fitting parameters are {A, B, C, p, I) and variable is x. I tried to use both Nonlinear Curve Fit VI and Constrained Nonlinear Curve Fit VI, but neither gives me fitting parameters other than what I input as the initial parameters. As an example I am attaching the data set file where the fist column is x and second column is y. The initial fit parameter set is {2,0,1,2,90}. It would be appreciated if someone could point out how I use either these fitting function to get the best fit.
04-07-2014 01:46 PM
We cannot see what's wrong unless you show us your code.
04-07-2014 02:06 PM
Actually my LV code is quite simple and has nearly nothing more than the nonlinear curve fit vi itself. Anyhow I am attached my code here so that you could at least run and see what my question is about. The caller VI is "Curve Fitting.vi". The subVI inside it that calls the curve fitting function has two flavors inside. What is enabled uses the contrained nonlinear curve fit vi while the other one that is currently disabled, calls the function of nonlinear curve fit vi.
Thanks.
04-07-2014 02:39 PM - edited 04-07-2014 02:50 PM
sorry i cannot open your vi because of version problem. do you use curve fitting from express option (path -> Express --signal analysis -- curve fitting ) or using simple curve fitting vi from maths option.
in the curve fitting from express option when double click the curve fitting you will get the prarameter setting pop up in which you can select between linear non linear and the also non linear model (equations). you first set the inital guess and can see the comaprision between origanl data and best fit curve. where they overlap that will be the best solution and provide best coeff.
04-07-2014 02:43 PM
I use LV 2012 to run this. And those two curve fitting functions are from Functions->Mathematics->Fitting.
04-07-2014 02:53 PM - edited 04-07-2014 02:54 PM
then try to use from express -- signal analysis -- curve fitting. but it is NOT included in base package.
in the curve fitting from express option when double click the curve fitting you will get the prarameter setting pop up in which you can select between linear non linear and the also non linear model (equations). you first set the inital guess and can see the comaprision between origanl data and best fit curve. where they overlap that will be the best solution and provide best coeff.
04-07-2014 03:10 PM
@Tirmizi wrote:
then try to use from express -- signal analysis -- curve fitting. but it is NOT included in base package..
Noooo please don't!
04-07-2014 03:11 PM
@stevensung wrote:
Actually my LV code is quite simple and has nearly nothing more than the nonlinear curve fit vi itself.
You did not include the model.
04-07-2014 03:18 PM
is there any reason of not using express - signal analysis --curve fitting option.
04-07-2014 03:33 PM
@Tirmizi wrote:
is there any reason of not using express - signal analysis --curve fitting option.
Hes is currently not using the express VIs, so switching over involves extra work. I am sure there is just a minor problem that can be fixed easily once we have all the code, including the model.
For my taste, express VIs are way too opaque to troubleshoot and really tell what's going wrong. Also, the fitting VIs using the VI model offer significantly better performance compared to models involving formula parsing.