Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

AlexF3449

Member

06-10-2021 01:03 PM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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

Solved! Go to Solution.

Solution

Accepted by topic author AlexF3449

altenbach

Knight of NI

06-10-2021 01:40 PM - edited 06-10-2021 01:42 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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.

06-10-2021 01:56 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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

Virus scan in progress. Please wait to download attachments.

altenbach

Knight of NI

06-10-2021 02:13 PM - edited 06-10-2021 02:15 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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

All I need is:

- the model VI (currently missing)
- 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?
- and the typical X range.

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