Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top



ClearAll[m, F, b, \[Omega], \[Delta]]
$Assumptions = x > 0 && m > 0 && F > 0 && b > 0 && \[Omega] > 0 && \[Delta] > 0;

In the following, $m$ is the mass of the mechanical system and $\delta$ is the phaseshift of the system.

m = 0.17869 + 0.01376/3;
\[Delta] = ArcTan[b/(m*(\[Omega]^2 - x^2))*x];

The experimental data:

data = {{0.7123448644,0.00246},{0.7324185582,0.00266},{0.7861292525,0.00328},{0.8523181889,0.00451},{0.9109116735,0.00647},{0.9282727060,0.00760},{0.9906639165,0.0114},{1.025928514,0.0152},{1.051970063,0.0222},{1.079096676,0.0131},{1.105138225,0.00865},{1.149625870,0.00549},{1.170242096,0.00455},{1.220155065,0.00336},{1.256504727,0.00267},{1.351990405,0.00184}};

The fitting function:

A[x_] := F/(m*\[Omega]^2*
     Sqrt[   (x - \[Delta])^4 
           + ((b/(m*\[Omega]))^2 - 2)*(x - \[Delta])^2 
           + 1])

where $F$, $b$, and $\omega$ are parameters connected to the system.

Determineing the missing parameters:

FindFit[data, A[x], {F, b, \[Omega]}, x]

{F -> 0.00584067, b -> 0.972727, [Omega] -> -1.10514}

F = 0.005840667856395345;
b = 0.9727272619465833;
\[Omega] = -1.105138224999997;

Plot of data and the fitting curve:

Show[Plot[A[x], {x, 0.6, 1.5}, PlotRange -> Full], ListPlot[data, PlotStyle -> Red]]


It is obvious that the fitting is all wrong.

How do I get the correct fitting parameters?

I know that the fit should give approximately

F = 0.03
b = 0.14
\[Omega] = 12

P.S. I would think that executing the first command would assure that $\omega > 0$ when finding the fitting parameters, but this is obviously not the case.

share|improve this question
There are not enough degrees of freedom in your model to accommodate this shift. Try with Manipulate to see what I mean. – Oleksandr R. Jan 2 '14 at 0:50
@OleksandrR. So I can't get a correct fit with the data available? – Svend Tveskæg Jan 2 '14 at 1:00
Apparently not, unless you modify the model to incorporate that small shift. How best to do that while retaining its physical validity (looks like some resonant mechanical system?) will depend on how the measurements are done and so on, and we can't really help you with that for obvious reasons. If these are experimental data, is it possible for example that all readings of x are slightly shifted due to an instrumental effect? Or maybe they're subject to a multiplicative error... – Oleksandr R. Jan 2 '14 at 1:07
@OleksandrR. I have updated my question. (It is indeed a mechanical system and one can get a phaseshift in order to horizontally correct the fitting function.) – Svend Tveskæg Jan 2 '14 at 6:05
@Nasser Can I make you write up an answer where the correct fit is obtained? (I have to go now and won't be back for the next 18-20 hours.) – Svend Tveskæg Jan 2 '14 at 15:07
up vote 4 down vote accepted

Although you haven't specified everything, here is one way to approach this:

a[x_] := F/(m*ω^2*Sqrt[(x - δ)^4 + ((b/(m*ω))^2 - 2)*(x - δ)^2 + 1]);
sol = NonlinearModelFit[data, a[x], 
   {{F, 0.03}, {b, 0.14}, {ω, 12}, {δ, 1}, {m, 0.17869 + 0.01376/3}}, x];
Show[ListPlot[data], Plot[sol[x], {x, 0.7, 1.4}]]

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.