# Errors in Gaussian fitting curve [closed]

I fitted simulation data with Gaussian fitting curve,

data25=Import["Downloads/n3/dmde_n3_e102_b25.dat", {"Data", {All}, {1, 2}}];
model25[c_] = ampl Evaluate[PDF[NormalDistribution[x0, sigma], c]];
fit = FindFit[data25, model25[c], {ampl, x0, sigma}, c]
g25 = Plot[{model25[c] /. fit}, {c, -1, 6}, Axes -> {False, True, False}, PlotRange -> {{-1, 6}, {0.0, 1.0}}]


However, the simulation data show great deviation from the fitted curve. I want to know how much Sigma should have deviated.

• Please provide the data! Apr 16, 2019 at 9:29
• you can upload the data here: pastebin.com Apr 16, 2019 at 9:30
• The fit looks OK. It seems to minimize the residuals of the single Gaussian. Obviously, the model is not suitable, i.e. a single Gaussian doen't fit the data. Apr 16, 2019 at 13:48

I am not sure what this part of the question means:

I want to know how much Sigma should have deviated.

I assume by finding a good fit using relatively few Gaussians OP would be able to find the desired answer.

I extracted the data from the image following this post: https://blog.wolfram.com/2012/01/04/how-to-count-cells-annihilate-sailboats-and-warp-the-mona-lisa/ .

Here is the data:

data = {{222.833, 224.833}, {220.188, 221.125}, {217.5,
221.5}, {216.773, 218.227}, {221.346, 217.962}, {213.5,
217.5}, {215.625, 215.375}, {212.786, 213.286}, {209.5,
211.3}, {211.625, 209.375}, {218.5, 206.}, {228.206,
203.912}, {223., 201.}, {207.147, 199.971}, {227.063,
200.125}, {229.2, 198.1}, {207.921, 195.395}, {208., 191.}, {231.98,
183.86}, {235., 184.5}, {205.409, 182.409}, {234.676,
180.559}, {236.833, 175.833}, {240.115, 174.654}, {200.071,
170.929}, {197.029, 170.147}, {236., 171.}, {200.55, 165.8}, {236.5,
167.}, {238.5, 161.5}, {193.5, 157.5}, {287., 156.}, {195.5,
153.5}, {148.147, 151.971}, {192.241, 153.352}, {243.63,
150.37}, {290., 151.}, {192.214, 148.595}, {187., 148.}, {152.5,
145.5}, {190.643, 144.857}, {187.885, 143.808}, {142.115,
143.577}, {146.5, 143.3}, {180.833, 142.667}, {243.5,
143.}, {287.375, 142.75}, {151.5, 142.5}, {294.5, 142.5}, {139.5,
141.167}, {281.615, 140.346}, {187.25, 140.813}, {277.583,
140.25}, {258.9, 138.9}, {137.9, 137.9}, {156., 138.}, {179.409,
138.318}, {190.125, 138.063}, {247.625, 138.375}, {275.8,
138.3}, {290.5, 138.5}, {186.5, 137.5}, {286.362,
138.293}, {158.625, 136.375}, {265., 136.5}, {297.5,
136.7}, {271.833, 133.542}, {283.658, 134.5}, {188., 134.}, {295.,
134.3}, {164.5, 133.25}, {176.5, 133.5}, {259.857,
132.643}, {281.643, 131.929}, {138.6, 131.3}, {168.222,
131.333}, {251., 129.}, {297.5, 129.5}, {301.026,
128.553}, {136.786, 127.69}, {275.056, 127.778}, {265.833,
125.5}, {297.206, 126.088}, {174.25, 125.}, {269., 125.5}, {165.8,
125.4}, {181.5, 124.458}, {135.978, 123.152}, {177.132,
123.5}, {259.409, 123.318}, {268.5, 123.}, {299.944,
123.056}, {132.5, 121.192}, {257.944, 121.167}, {136.3,
119.5}, {300.761, 119.152}, {134.318, 115.318}, {303.833,
115.352}, {132.167, 113.389}, {305.5, 112.}, {302.591,
111.136}, {130., 110.786}, {132.5, 109.5}, {305.808,
109.423}, {128.423, 107.192}, {132., 106.5}, {306.643,
106.571}, {306.397, 103.086}, {122.206, 92.7353}, {309.654,
91.0385}, {118.583, 85.1667}, {118.167, 80.9667}, {114.773,
80.2273}, {315.5, 80.}, {114.109, 71.1087}, {328.167,
71.5833}, {101.3, 69.18}, {106.5, 69.7857}, {109.9, 70.3}, {324.577,
69.1923}, {337.038, 68.3462}, {97.5, 67.}, {106.727,
66.0909}, {327.917, 67.25}, {92.9286, 66.0714}, {88., 65.}, {344.5,
65.5}, {350.1, 65.1}, {101.643, 63.5}, {353.5, 64.5}, {359.,
64.5}, {67.5, 63.5}, {364.5, 63.5}, {95.8684, 63.4474}, {98.2143,
62.3571}};

ListPlot[data]


Then I applied the procedure described in this answer using Gaussian bases instead of a Sin/Cos one.

The obtained fit is:

qFunc

(* 61.406 E^(-(1/800) (-290 + x)^2) + 49.9485 E^(-((-290 + x)^2/12800)) +
118.492 E^(-(1/800) (-220 + x)^2) + 17.5995 E^(-((-220 + x)^2/12800)) +
53.521 E^(-(1/800) (-150 + x)^2) + 64.2894 E^(-((-150 + x)^2/12800)) *)


Here is a plot of the data and the fit function:

Show[{ListPlot[data, PlotRange -> All],
Plot[qFunc, {x, Min[data[[All, 1]]], Max[data[[All, 1]]]}, PlotStyle -> Red,
PerformanceGoal -> "Quality"]}]


(Note that the good fit is obtained with OP's image red points, not OP's data.)