# Plotting amplitude vs frequency in Mathematica

I want to plot an amplitude vs frequency with this formula:

By using this data:

So it should look like this:

Unfortunately, I don´t manage it to plot this. Could someone help please ?

• Could you please make the input data a $9\times 2$ list? – Αλέξανδρος Ζεγγ Jul 31 at 6:49
• xx = {4.19, 3.93, 3.7, 3.49, 3.31, 3.31, 3.14, 2.99, 1.75}; yy = {0.18, 0.35, 0.45, 1.06, 1.13, 0.77, 0.57, 0.34, 0.14}; – Tom Jul 31 at 7:06
• Thi forum is devoted to WolframMathematica (shorter Mathematica). There is no need to stress Mathematica in the title. – user64494 Jul 31 at 7:23
• The size of your data which equals 9 is too small for reliable conclusions. – user64494 Jul 31 at 7:26

This is only meant as an answer to a question in one of the comments about how to reverse the x-axis that I couldn't fit into a comment easily.

You can add the option ScalingFunctions -> {"Reverse", None} to the plot in order to reverse the x-axis. Unfortunately, this means that the data points themselves will not show up. Probably the easiest solution is to show the points in a separate ListPlot and reverse the x-axis there as well:

Show[
Plot[
Evaluate[model /. fittedparameters],
{\[Omega], 1, 5},
PlotRange -> All,
PlotStyle -> Blue,
ScalingFunctions -> {"Reverse", None}
],
ListPlot[
data,
PlotStyle -> Red,
ScalingFunctions -> {"Reverse", None}
]
]

• Looks great, thank you! – Tom Jul 31 at 15:18
• No problem, but you can only accept one of the answers, and I think it should go to Αλέξανδρος-Ζεγγ as they answered the main question. My "answer" was just meant to slightly build upon their answer. – MassDefect Jul 31 at 16:06
• So it cannot work with Epilog? – Αλέξανδρος Ζεγγ Aug 1 at 5:17
• @ΑλέξανδροςΖεγγ IMO, the way MMA reverses the axes is a bit hack-y. It basically takes the negative of everything so that Epilog points are no longer in the place you would expect them. To reverse the x-axis using your method, I would add ScalingFunctions -> {"Reverse", None} to the list of options, and then inside the Epilog I would change Point[data] to Point[data.{{-1, 0}, {0, 1}}]. – MassDefect Aug 1 at 5:54
• @MassDefect Inspiring, thx very much! – Αλέξανδρος Ζεγγ Aug 1 at 6:02

The input data is arranged as

data = {{4.19, 3.93, 3.7, 3.49, 3.31, 3.31, 3.14, 2.99, 1.75}, {0.18, 0.35, 0.45, 1.06, 1.13, 0.77, 0.57, 0.34, 0.14}}\[Transpose];

Then fit a nonlinear model

model = (a ω^2) / Sqrt[(ω^2 - ωe^2)^2 + 4 γ^2 ωe^2];
fittedparameters = FindFit[data, model, {a, ωe, γ}, ω]

which returns

{a -> 0.0895665, ωe -> 3.394, γ -> 0.123515}

So finally plot the result

Plot[Evaluate[model /. fittedparameters], {ω, 1, 5}, PlotRange -> All, PlotStyle -> Blue, Epilog -> {Red, PointSize[.015], Point[data]}]

• Thank you very much, looks great!!! – Tom Jul 31 at 7:19
• I think the plot should converge towards 0, not starting at 0. How could we mirror the x-axis ? – Tom Jul 31 at 7:59
• @Tom Could please rephrase your statement, but I could really not quite catch you. – Αλέξανδρος Ζεγγ Jul 31 at 8:01
• I mean, how could we realize to start x-axis at 5 going down to 0 from left to right, so the graph would decay towards 0.. so just rotate x-axis 180° – Tom Jul 31 at 8:06
• @Tom Do you mean to make the ticks on the $x$-axis go from large to small? – Αλέξανδρος Ζεγγ Jul 31 at 8:11