using curve fitting
saeed
I have one plot and I want to use curve fitting to fit this plot with Bessel function but there is not Bessel function between the another function in curve fitting tab and also I define this function but it dose not work. I am not sure my definition is curect and also what do I add in the coefficients?
Thanks
DisplayHelpTopic "Fitting to a User-Defined Function"
If not, then you better post a complete example. An Igor experiment file with your user-defined fit function and a data set, plus a description of what you tried and what happened. "Does not work" doesn't give us enough information to begin trying to help you.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 28, 2014 at 03:59 pm - Permalink
I am newbie in Igor. I read this help and I use that, I like after using this fitting the fitting appeare in my plot like Quick fit but it did not happen.
I attached my code and as you see I have one plot which I want to fit the first order of the Bessel function.
April 28, 2014 at 04:33 pm - Permalink
I'm not sure what part of your fit function you intend to be coefficients. You probably want to be able to adjust the X scale, possibly the X location, and probably the amplitude.
You probably should use the built-in Besselj, Besseli, etc. functions that Igor provides.
I tried to create a fit function based on the built-in Besselj function with n=0. That function doesn't look much like your data, so I didn't continue. Here is my function, for what it's worth:
Wave w
Variable x
//CurveFitDialog/ These comments were created by the Curve Fitting dialog. Altering them will
//CurveFitDialog/ make the function less convenient to work with in the Curve Fitting dialog.
//CurveFitDialog/ Equation:
//CurveFitDialog/ f(x) = A*Besselj(0, (x-x0)/d)
//CurveFitDialog/ End of Equation
//CurveFitDialog/ Independent Variables 1
//CurveFitDialog/ x
//CurveFitDialog/ Coefficients 3
//CurveFitDialog/ w[0] = A
//CurveFitDialog/ w[1] = x0
//CurveFitDialog/ w[2] = d
return w[0]*Besselj(0, (x-w[1])/w[2])
End
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 28, 2014 at 04:50 pm - Permalink
April 29, 2014 at 05:52 am - Permalink
I got my mistake.
I have another question:
How can I write this equation
(x^2 ){d^2 y/dx^2} + x *{dy/dx} + (x^2 - alpha^2)*y = 0 in Fit expression in fit function part?
Because it did not accept differential part in this form.
May 12, 2014 at 08:52 am - Permalink
It's generally better to start a new thread.
You need to solve your differential equation, and then write a fitting function that uses that solution. That's two problems... If there is an analytic solution to your equation, it is best to find it and then implement your function using that analytic solution. If there is no analytic solution, then you need to solve it numerically. Read about that here:
DisplayHelpTopic "Solving Differential Equations"
I strongly recommend that you get that working before trying to do a curve fit using your solution.
Once you have a working numerical solution, you need to wrap the call to IntegrateODE in an all-at-once fit function. Read about all-at-once fit functions:
DisplayHelpTopic "All-At-Once Fitting Functions"
There is a demo experiment that does a curve fit to a simple differential equation. Pull down the File menu and select Example Experiments->Analysis->Differential Equation Demo.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
May 12, 2014 at 10:05 am - Permalink