LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Constraining values in non-linear curve fit

Solved!
Go to solution

Hi all,

I am trying to use the non-linear curve fit function Lev-mar IV to try to find a best fit line for some data which is modeled by an equation which contains some complex numbers and hyperbolic trig functions. The best fit cure always returns to me as a nearly horizontal line. I think i would be able to solve this problem If I could place upper and lower bounds on two of the three variables the equation is optimizing, and if I could reduce the "step size" the function goes at when optimizing.

 

Further info:

I believe that the step size of the function is too large as when I run the program with the optimization function iterating once with very high tolerance, the input values are not returned to me; instead I receive values that have been off by as much as 250. Additionally, these values are negative, and the real life phenomenon that the model represents cannot be negative.

Thanks for your time

0 Kudos
Message 1 of 4
(1,767 Views)
Solution
Accepted by AlexF3449

As a starting point, you can try the Constrained Nonlinear Curve Fit VI , which lets you define parameter bounds. Still maybe you should carefully analyze the problem, for example are some parameters highly correlated? How do the partial derivatives look like? Sometimes you can reparametrize the model differently for a more stable fit.

 

Feel free to attach your Code and some typical data.

Message 2 of 4
(1,748 Views)

I've attached some code for you to look at. the file reflection with two windows is the program and the other file is for reference for the optimization function. I cannot attach any data sets because most of my data is spreadsheets with thousands of rows, the file is too large.

Download All
0 Kudos
Message 3 of 4
(1,740 Views)

Thanks. I will probably not weed through all that messy code.

 

All I need is:

  1. the model VI (currently missing)
  2. a set of typical parameters and d2 wired to the "data" input (are there really only three? Are the control values reasonable?). Is the data currently in the graphs typical?
  3. and the typical X range.

 

If you simulate the data using the parameter guesses, how similar is it to the experimental data?

0 Kudos
Message 4 of 4
(1,730 Views)