Curve Fitting an integral that has limits that are from a wave
| dwillia5 | May 23, 2012 - 16:25 | ||
|---|---|---|---|
|
Hi, //This is the user-defined fitting function: Variable/G Alpha=A, Beta1=B1, Beta2=B2, Length = L //Parameters to be fitted //This is the function it calls: //The constants |
|||

Joined: 2007-06-29
Location: United States
Since the FuncFit operation has to be able to assemble data and call your fit function itself, there are strict rules on the inputs to a fitting function. Your function doesn't fit those rules. You can read about the rules by executing this command on Igor's command line:
DisplayHelpTopic "User-Defined Fitting Function: Detailed Description"
FuncFit accepts a variety of different format in order to handle various situations.
Your function lacks an input wave corresponding to the coefficient wave. That wave has the adjustable parameters that are the point of the curve fit. So my next question is- what are the adjustable parameters in your function?
Your subject line says you want to get the limits of integration from a wave, but in fact you have an equation for the limit that depends on X (which I presume is the independent variable in your curve fit). So you don't need to get the limits from a wave, you need to compute it depending on the value of X.
Oh, wait- I just understood your bits of code and commands. You need to wrap up the three lines at the top in a user-defined function of the appropriate format. Something like this:
There is still a problem- your command
Real(Integrate1d(eqn...)suggests that you expect a complex value from Integrate1D, but Integrate1D returns a real value. It only integrates real-valued integrands. So we may not be there yet...John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Joined: 2011-08-16
Location: United States
Thanks!! The problem was in the line f(T) = Real(Integrate1d(eqn, .001, 281/Temp)). To get this fuction, I had edited another fit function that integrated over complex values and missed the "Real" in that line. The program works perfectly now. Thanks again.