
Funcfit for multivariable (over 20) equation

imksh2000
Please see attached exp files.
The algorithm is following:
1) Load experimental data wave (not included in the attached file)
2) After recall function setup_display_range() and calculation(), open parameter control macro
3) Setup parameters in order to obtain similar generated graph for the experimental data
// THE FOLLOWING IS FUNCFIT BUT I CANNOT //
4) Save parameters in the panels as initial value of fitting
5) Run funcfit function
For 4) and 5), I should recall all the parameters as coefficient wave and WRITE DOWN ALL THE EQUATION SUCH AS F_uc, F_ctr, and so on.
Is there are clear way to design simple function to get funcfit?
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
October 12, 2015 at 09:51 am - Permalink
Thank you for your sincere help.
Unfortunately, my question was more focused on how to build myHugeFitFunct.
As you can see in the experiments, I want to utilize CALCULATION() function as myHugeFitFunc.
Is there any nice solution for that?
October 12, 2015 at 02:47 pm - Permalink
DisplayHelpTopic "Fitting to a User-Defined Function"
That topic talks about using the Curve Fit dialog to build and use a user-defined fit function. For your purposes, you will want to edit the Calculation function to make it into a fit function. To learn the proper format, read this topic:
DisplayHelpTopic "User-Defined Fitting Function: Detailed Description"
It's hard to tell from your code what the independent variable is (variables?) or which are constants. The use of global variables for adjustable parameters is discouraged- it makes it hard to debug problems, and easy to make mistakes in setting up to run the function. It is also inefficient for use as a fitting function.
If you want to use Calculation() as the engine for both simulations and for fitting, I would do this:
1) Use the Constant keyword to define numbers that are truly constants, that you will never change. I presume that the global variable that you declare this way:
variable/g atomic_frac_Y = 0.148
are actually constants. That one could be defined this way, above the definition of the function:
Constant atomic_frac_Y = 0.148
2) Make the adjustable parameters into input parameters. Assuming that the uninitialized globals are actually adjustable parameters, you would do something like
3) It's probably easiest to use the standard fit function format that calls the function once for each X value, and returns one Y value for each. I see
wave Q_x, atomic_position
at the top of Calculation(). Assuming that Q_x is the X value, now the function would look like4) Now, to create a fit function you might write this:
To be sure, I see some things that suggest that perhaps you need to compute all results at the same time. In the detailed description help cited above, you need to read about all-at-once fit functions. They take in an X wave (or waves if it is a multivariate fit) and set the Y values in the Y wave input parameter. They return nothing. All-at-once functions are more challenging to write and debug but generally run faster. Some problems can only be computed using an all-at-once fit function.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
October 13, 2015 at 12:39 pm - Permalink