LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Nonlinear Curve Fit VI keeps all initial parameters

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.

0 Kudos
Message 1 of 23
(3,200 Views)

We cannot see what's wrong unless you show us your code.

0 Kudos
Message 2 of 23
(3,180 Views)

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.

Download All
0 Kudos
Message 3 of 23
(3,169 Views)

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.

0 Kudos
Message 4 of 23
(3,162 Views)

I use LV 2012 to run this. And those two curve fitting functions are from Functions->Mathematics->Fitting.

0 Kudos
Message 5 of 23
(3,157 Views)

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.

0 Kudos
Message 6 of 23
(3,152 Views)

@Tirmizi wrote:

then try to use from express -- signal analysis -- curve fitting. but it is NOT included in base package..


Noooo please don't!

0 Kudos
Message 7 of 23
(3,143 Views)

@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.

0 Kudos
Message 8 of 23
(3,142 Views)

is there any reason of not using express - signal analysis --curve fitting option.

0 Kudos
Message 9 of 23
(3,133 Views)

@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.

0 Kudos
Message 10 of 23
(3,126 Views)