How do I Fit a Resonance Curve?

What you want to find is the parameters $\theta=(C, \omega_0, \gamma)$ that minimizes the difference between $\nu(\omega|\theta)$ (the curve given the parameters) and the measured $\nu_i$ values.

The most popular method is least mean square fitting, which minimizes the sum of the squares of the differences. One can also do it by formulating the normal equations and solve it as a (potentially big) linear equation system. Another approach is the Gauss-Newton algorithm, a simple iterative method to do it. It is a good exercise to implement the solution oneself, but once you have done it once or twice it is best to rely on some software package.

Note that this kind of fitting works well when you know the functional form (your equation for $\nu(\omega)$), since you can ensure only that the parameters that matter are included. If you try to fit some general polynomial or function you can get overfitting (some complex curve that fits all the data but has nothing to do with your problem) besides the problem of identifying the parameters you care about.


Don't try using any general-purpose curve fitting algorithm for this.

The form of your function looks like a frequency response function, with the two unknown parameters $\omega_0$ and $\gamma$ - i.e. the resonant frequency, and the damping parameter. The function you specified omits an important feature if this is measured data, namely the relative phase between the "force" driving the oscillation and the response.

If you didn't measure the phase at each frequency, repeat the experiment, because that is critical information.

When you have the amplitude and phase data, there are curve fitting techniques devised specifically for this problem of "system identification" in experimental modal analysis. A simple one is the so-called "circle fitting" method. If you make a Nyquist plot of your measured data (i.e. plot imaginary part of the response against the real part), the section of the curve near the resonance is a circle, and you can fit a circle to the measured data and find the parameters from it.

In practice, a simplistic approach assuming the system only has one resonance often doesn't work well, because the response of a real system near resonance also includes the off-resonance response to all the other vibration modes. If the resonant frequencies are well separated and lightly damped, it is possible to correct for this while fitting "one mode at a time". If this is not the case, you need methods that can identify several resonances simultaneously from one response function.

Rather than re-invent the wheel, use existing code. The signal processing toolbox in MATLAB would be a good starting point - for example https://uk.mathworks.com/help/signal/ref/modalfit.html


If we put:

$$Y = \frac{\omega^2}{u(\omega)^2}$$

and

$$X = \omega^2$$

the equation becomes:

$$Y =\frac{X^2}{C^2} +\frac{(\gamma^2 - 2 \omega_0^2)}{C^2} X + \frac{\omega_0^4}{C^2}$$

You can then extract the coefficients using polynomial fitting. To get the least-squares fit right, you have to compute the errors in $Y$ and $X$ for each data point from the measurement errors in $\omega$ and $u(\omega)$.