Resonance curve fitting with Mathematica

In summary, the conversation is about fitting a resonance curve to a set of data points using the equation model = a/Sqrt[4 k w^2 + (v^2 - w^2)^2]. The person is having trouble finding the best fit for the data and has tried various methods such as FindFit and NonlinearModelFit, but has not been successful. They are seeking help and suggestions for finding the best parameters for the fit.
  • #1
greedo
I have to fit a resonance curve to my data points, where the equation for the curve and the data points are:

Code:
model = a/Sqrt[4 k w^2 + (v^2 - w^2)^2]

data = {{242, 7/10}, {244.3`, 1}, {245.33`, 3/2}, {245.54`, 
   2}, {248.63`, 4}, {249.6`, 5}, {250.48`, 34/5}, {250.91`, 
   8}, {251.18`, 9}, {251.35`, 10}, {252.76`, 20}, {253.25`, 
   40}, {253.5`, 55}, {253.6`, 70}, {253.7`, 75}, {253.9`, 
   77}, {254.16`, 66}, {254.5`, 47}, {254.86`, 33}, {255.82`, 
   15}, {257, 5}};

I need to find the parameters that give the best fit for the data. This is the command I think is the closest to the solution:
Code:
fit = FindFit[
  data, {model, {0 <= k}}, {{a, 30}, {k, 0.007}, {v, 253}}, w}

but i get the error:
Code:
FindFit::eit: The algorithm does not converge to the tolerance of 4.806217383937354`*^-6 in 500 iterations. The best estimated solution, with feasibility residual, KKT residual or complementary residual of {...} is returned

I have tried playing with starting values, conditionals, NonlinearModelFit and others but none of them work. Could someone please help?
 
Physics news on Phys.org
  • #2
greedo said:
I have to fit a resonance curve to my data points, where the equation for the curve and the data points are:

Code:
model = a/Sqrt[4 k w^2 + (v^2 - w^2)^2]

data = {{242, 7/10}, {244.3`, 1}, {245.33`, 3/2}, {245.54`, 
   2}, {248.63`, 4}, {249.6`, 5}, {250.48`, 34/5}, {250.91`, 
   8}, {251.18`, 9}, {251.35`, 10}, {252.76`, 20}, {253.25`, 
   40}, {253.5`, 55}, {253.6`, 70}, {253.7`, 75}, {253.9`, 
   77}, {254.16`, 66}, {254.5`, 47}, {254.86`, 33}, {255.82`, 
   15}, {257, 5}};

I need to find the parameters that give the best fit for the data. This is the command I think is the closest to the solution:
Code:
fit = FindFit[
  data, {model, {0 <= k}}, {{a, 30}, {k, 0.007}, {v, 253}}, w}

but i get the error:
Code:
FindFit::eit: The algorithm does not converge to the tolerance of 4.806217383937354`*^-6 in 500 iterations. The best estimated solution, with feasibility residual, KKT residual or complementary residual of {...} is returned

I have tried playing with starting values, conditionals, NonlinearModelFit and others but none of them work. Could someone please help?
That error just means that your initial guess is too far off. I got it to work without error for an initial guess of a=10000 and k=1 and v=253.
 
  • #3
hi, my suggestion is first you take the initial values for the fit from the experimental data. It is easy just plot and see...and take the initial value and include it in fit routine. origin software can do this job ..or you can use gnuplot..but in gnuplot you get only the fitted curve instead of the individual components..anyways you get the accurate output.
good luck..
 

1. What is resonance curve fitting?

Resonance curve fitting is a scientific method used to analyze and model the behavior of a system that responds to a varying input over a range of frequencies. It is commonly used in fields such as physics, engineering, and chemistry to study the properties of oscillating systems.

2. How does Mathematica assist in resonance curve fitting?

Mathematica is a powerful computational software that can perform complex mathematical and statistical analyses. It has built-in functions and algorithms specifically designed for resonance curve fitting, making it a highly efficient tool for this task.

3. What types of data can be used for resonance curve fitting with Mathematica?

Mathematica can handle a wide range of data types, including experimental measurements, theoretical models, and simulated data. The data can be in any format, such as numerical, textual, or graphical, and can be imported from various sources.

4. Can Mathematica handle complex resonance curve fitting problems?

Yes, Mathematica has advanced algorithms for nonlinear and multi-parameter curve fitting, making it suitable for complex resonance curve fitting problems. It also has a user-friendly interface that allows for interactive exploration and visualization of the results.

5. Are there any resources available for learning resonance curve fitting with Mathematica?

Yes, there are numerous online tutorials, guides, and forums dedicated to teaching resonance curve fitting with Mathematica. The official Mathematica website also has comprehensive documentation and examples for users to learn from.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
5K
Back
Top