Mathematica Asked on September 26, 2021
I need to improve the performance of my fit. Below you can find the data I am using
abs0={{1.49578, 0.00509411}, {1.49758, 0.0022425}, {1.4994,
0.00329417}, {1.50121, -0.00082697}, {1.50303,
0.00177372}, {1.50485, 0.00604665}, {1.50668, 0.00185646}, {1.50852,
0.00105863}, {1.51035, 0.00227007}, {1.5122,
0.00565293}, {1.51404, -0.00303942}, {1.51589, 0.0061382}, {1.51775,
0.00905397}, {1.51961, 0.0091133}, {1.52147, 0.00889652}, {1.52334,
0.0155424}, {1.52522, 0.0181571}, {1.52709, 0.0160183}, {1.52898,
0.0181481}, {1.53086, 0.0149121}, {1.53276, 0.0238468}, {1.53465,
0.0256343}, {1.53656, 0.0300686}, {1.53846, 0.0312851}, {1.54037,
0.0390584}, {1.54229, 0.0446027}, {1.54421, 0.0443409}, {1.54613,
0.051007}, {1.54806, 0.0576852}, {1.55, 0.0629538}, {1.55194,
0.0747076}, {1.55388, 0.0779977}, {1.55583, 0.0868124}, {1.55779,
0.0977768}, {1.55975, 0.103973}, {1.56171, 0.110883}, {1.56368,
0.127967}, {1.56566, 0.14099}, {1.56764, 0.145288}, {1.56962,
0.158275}, {1.57161, 0.175463}, {1.5736, 0.182419}, {1.5756,
0.195913}, {1.57761, 0.207938}, {1.57962, 0.220793}, {1.58163,
0.236395}, {1.58365, 0.247388}, {1.58568, 0.257808}, {1.58771,
0.272624}, {1.58974, 0.290272}, {1.59178, 0.306956}, {1.59383,
0.320756}, {1.59588, 0.333634}, {1.59794, 0.349456}, {1.6,
0.365959}, {1.60207, 0.378456}, {1.60414, 0.395112}, {1.60622,
0.411895}, {1.6083, 0.42593}, {1.61039, 0.439861}, {1.61248,
0.456248}, {1.61458, 0.471788}, {1.61669, 0.486072}, {1.6188,
0.499901}, {1.62092, 0.51111}, {1.62304, 0.525089}, {1.62516,
0.538244}, {1.6273, 0.546086}, {1.62943, 0.557702}, {1.63158,
0.566626}, {1.63373, 0.575678}, {1.63588, 0.584182}, {1.63804,
0.592093}, {1.64021, 0.598691}, {1.64238, 0.602149}, {1.64456,
0.607737}, {1.64675, 0.611437}, {1.64894, 0.616952}, {1.65113,
0.619737}, {1.65333, 0.624947}, {1.65554, 0.62861}, {1.65775,
0.630635}, {1.65997, 0.632836}, {1.6622, 0.634548}, {1.66443,
0.63701}, {1.66667, 0.639435}, {1.66891, 0.640329}, {1.67116,
0.642363}, {1.67341, 0.643528}, {1.67568, 0.644296}, {1.67794,
0.644422}, {1.68022, 0.645809}, {1.6825, 0.647238}, {1.68478,
0.647883}, {1.68707, 0.649086}, {1.68937, 0.649686}, {1.69168,
0.65006}, {1.69399, 0.650858}, {1.69631, 0.652325}, {1.69863,
0.652305}, {1.70096, 0.651753}, {1.7033, 0.653752}, {1.70564,
0.654445}, {1.70799, 0.655337}, {1.71034, 0.656208}, {1.71271,
0.657092}, {1.71508, 0.656519}, {1.71745, 0.65633}, {1.71983,
0.657321}, {1.72222, 0.658025}, {1.72462, 0.658856}, {1.72702,
0.65955}, {1.72943, 0.659267}, {1.73184, 0.659702}, {1.73427,
0.660228}, {1.73669, 0.661243}, {1.73913, 0.66167}, {1.74157,
0.662056}, {1.74402, 0.663011}, {1.74648, 0.663918}, {1.74894,
0.665163}, {1.75141, 0.665919}, {1.75389, 0.666071}, {1.75637,
0.666148}, {1.75887, 0.666399}, {1.76136, 0.66729}, {1.76387,
0.669091}, {1.76638, 0.669506}, {1.7689, 0.66943}, {1.77143,
0.66982}, {1.77396, 0.669999}, {1.7765, 0.671048}, {1.77905,
0.671755}, {1.78161, 0.672492}, {1.78417, 0.67287}, {1.78674,
0.673141}, {1.78932, 0.674042}, {1.79191, 0.675261}, {1.7945,
0.675804}, {1.7971, 0.676742}, {1.79971, 0.676843}, {1.80233,
0.677398}, {1.80495, 0.678248}, {1.80758, 0.679449}, {1.81022,
0.679594}, {1.81287, 0.67969}, {1.81552, 0.680442}, {1.81818,
0.681443}, {1.82085, 0.682353}, {1.82353, 0.682636}, {1.82622,
0.683182}, {1.82891, 0.68388}, {1.83161, 0.684669}, {1.83432,
0.685613}, {1.83704, 0.685719}, {1.83976, 0.686247}, {1.8425,
0.687041}, {1.84524, 0.688092}, {1.84799, 0.688864}, {1.85075,
0.689607}, {1.85351, 0.690527}, {1.85629, 0.691013}, {1.85907,
0.691305}, {1.86186, 0.692082}, {1.86466, 0.692353}, {1.86747,
0.693202}, {1.87029, 0.693976}, {1.87311, 0.694399}, {1.87595,
0.695211}, {1.87879, 0.695624}, {1.88164, 0.695668}, {1.8845,
0.696512}, {1.88737, 0.697999}, {1.89024, 0.698598}, {1.89313,
0.698528}, {1.89602, 0.699096}, {1.89893, 0.700826}, {1.90184,
0.701929}, {1.90476, 0.702008}, {1.90769, 0.702246}, {1.91063,
0.703063}, {1.91358, 0.704039}, {1.91654, 0.70439}, {1.9195,
0.705054}, {1.92248, 0.706026}, {1.92547, 0.706451}, {1.92846,
0.706737}, {1.93146, 0.707545}, {1.93448, 0.708382}, {1.9375,
0.708863}, {1.94053, 0.709315}, {1.94357, 0.709921}, {1.94662,
0.710404}, {1.94969, 0.710364}, {1.95276, 0.711125}, {1.95584,
0.712035}, {1.95893, 0.712606}, {1.96203, 0.713286}, {1.96513,
0.713928}, {1.96825, 0.71414}, {1.97138, 0.714448}, {1.97452,
0.715087}, {1.97767, 0.715332}, {1.98083, 0.715953}, {1.984,
0.716967}, {1.98718, 0.717854}, {1.99037, 0.71821}, {1.99357,
0.718389}, {1.99678, 0.718952}, {2., 0.719706}, {2.00323,
0.719948}, {2.00647, 0.720574}, {2.00972, 0.721094}, {2.01299,
0.721485}, {2.01626, 0.722102}, {2.01954, 0.722483}, {2.02284,
0.722991}, {2.02614, 0.723695}, {2.02946, 0.723773}, {2.03279,
0.72368}, {2.03612, 0.724231}, {2.03947, 0.72494}, {2.04283,
0.724992}, {2.0462, 0.725242}, {2.04959, 0.725913}, {2.05298,
0.726528}, {2.05638, 0.726758}, {2.0598, 0.726966}, {2.06323,
0.727042}, {2.06667, 0.727363}, {2.07012, 0.727925}, {2.07358,
0.728029}, {2.07705, 0.728384}, {2.08054, 0.729003}, {2.08403,
0.729319}, {2.08754, 0.729341}, {2.09106, 0.72964}, {2.09459,
0.729761}, {2.09814, 0.730151}, {2.10169, 0.730333}, {2.10526,
0.730744}, {2.10884, 0.730812}, {2.11244, 0.730961}, {2.11604,
0.731371}, {2.11966, 0.731465}, {2.12329, 0.731781}, {2.12693,
0.731709}, {2.13058, 0.73192}, {2.13425, 0.732367}, {2.13793,
0.73264}, {2.14162, 0.732404}, {2.14533, 0.73271}, {2.14905,
0.732815}, {2.15278, 0.732892}, {2.15652, 0.732926}, {2.16028,
0.732813}, {2.16405, 0.733228}, {2.16783, 0.733051}, {2.17163,
0.733054}, {2.17544, 0.733043}, {2.17926, 0.733432}, {2.1831,
0.733544}, {2.18695, 0.733667}, {2.19081, 0.733485}, {2.19469,
0.733688}, {2.19858, 0.733274}, {2.20249, 0.733447}, {2.20641,
0.733521}, {2.21034, 0.733722}, {2.21429, 0.733999}, {2.21825,
0.733812}, {2.22222, 0.733634}, {2.22621, 0.733413}, {2.23022,
0.733337}, {2.23423, 0.733493}, {2.23827, 0.733658}, {2.24231,
0.733456}, {2.24638, 0.733405}, {2.25045, 0.733457}, {2.25455,
0.733141}, {2.25865, 0.732918}, {2.26277, 0.732927}, {2.26691,
0.73285}, {2.27106, 0.733074}, {2.27523, 0.73271}, {2.27941,
0.73236}, {2.28361, 0.731975}, {2.28782, 0.732142}, {2.29205,
0.731532}, {2.2963, 0.732177}, {2.30056, 0.731507}, {2.30483,
0.731386}, {2.30912, 0.731623}, {2.31343, 0.731558}, {2.31776,
0.731069}, {2.3221, 0.730709}, {2.32645, 0.730569}, {2.33083,
0.730034}, {2.33522, 0.730129}, {2.33962, 0.730152}, {2.34405,
0.729749}, {2.34848, 0.729765}, {2.35294, 0.729444}, {2.35741,
0.728978}, {2.3619, 0.729156}, {2.36641, 0.728862}, {2.37094,
0.72835}, {2.37548, 0.728407}, {2.38004, 0.728074}, {2.38462,
0.727873}, {2.38921, 0.727564}, {2.39382, 0.727742}, {2.39845,
0.727415}, {2.4031, 0.726997}, {2.40777, 0.726756}, {2.41245,
0.726722}, {2.41715, 0.726297}, {2.42188, 0.725952}, {2.42661,
0.72552}, {2.43137, 0.725371}, {2.43615, 0.725042}, {2.44094,
0.724985}, {2.44576, 0.72473}, {2.45059, 0.724753}, {2.45545,
0.724199}, {2.46032, 0.723937}, {2.46521, 0.72387}, {2.47012,
0.723718}, {2.47505, 0.723546}, {2.48, 0.723402}, {2.48497,
0.72293}, {2.48996, 0.724191}, {2.49497, 0.723361}, {2.5,
0.723627}, {2.50505, 0.723837}, {2.51012, 0.724154}, {2.51521,
0.723907}, {2.52033, 0.72391}, {2.52546, 0.724224}, {2.53061,
0.724283}, {2.53579, 0.724957}, {2.54098, 0.725186}, {2.5462,
0.724852}, {2.55144, 0.725683}, {2.5567, 0.725623}, {2.56198,
0.726369}, {2.56729, 0.726516}, {2.57261, 0.727387}, {2.57796,
0.727834}, {2.58333, 0.728057}, {2.58873, 0.727506}, {2.59414,
0.728183}, {2.59958, 0.72871}, {2.60504, 0.728908}, {2.61053,
0.729569}, {2.61603, 0.729642}, {2.62156, 0.730273}, {2.62712,
0.730593}, {2.6327, 0.731113}, {2.6383, 0.731151}, {2.64392,
0.73141}, {2.64957, 0.732049}, {2.65525, 0.73225}, {2.66094,
0.73271}, {2.66667, 0.7331}, {2.67241, 0.733315}, {2.67819,
0.733465}, {2.68398, 0.733566}, {2.6898, 0.734093}, {2.69565,
0.734283}, {2.70153, 0.73454}, {2.70742, 0.735146}, {2.71335,
0.735128}, {2.7193, 0.735132}, {2.72527, 0.735174}, {2.73128,
0.735758}, {2.73731, 0.735796}, {2.74336, 0.736032}, {2.74945,
0.736326}, {2.75556, 0.736043}, {2.76169, 0.735929}, {2.76786,
0.735893}, {2.77405, 0.736086}, {2.78027, 0.735982}, {2.78652,
0.736211}, {2.79279, 0.735992}, {2.7991, 0.735668}, {2.80543,
0.735723}, {2.81179, 0.735546}, {2.81818, 0.735057}, {2.8246,
0.734785}, {2.83105, 0.734563}, {2.83753, 0.734241}, {2.84404,
0.733839}, {2.85057, 0.733507}, {2.85714, 0.733037}, {2.86374,
0.732326}, {2.87037, 0.7321}, {2.87703, 0.732003}, {2.88372,
0.731022}, {2.89044, 0.73078}, {2.8972, 0.730348}, {2.90398,
0.729563}, {2.9108, 0.728733}, {2.91765, 0.728456}, {2.92453,
0.727529}, {2.93144, 0.727269}, {2.93839, 0.726441}, {2.94537,
0.725793}, {2.95238, 0.725178}, {2.95943, 0.724772}, {2.96651,
0.724038}, {2.97362, 0.722737}, {2.98077, 0.721728}, {2.98795,
0.721082}, {2.99517, 0.72036}, {3.00242, 0.719598}, {3.00971,
0.718394}, {3.01703, 0.717919}, {3.02439, 0.717341}, {3.03178,
0.716187}, {3.03922, 0.715674}, {3.04668, 0.715021}, {3.05419,
0.713746}, {3.06173, 0.713447}, {3.06931, 0.712884}, {3.07692,
0.711896}, {3.08458, 0.711722}, {3.09227, 0.710355}, {3.1, 0.70924}}
This is the fit I need to use
paraConst = QuantityMagnitude[Quantity[0.001, "per eV"]]
cont3[h[Omega]_?NumericQ, Eb_?NumericQ,
Eg_?NumericQ, [CapitalGamma]_?NumericQ, paraConst_?NumericQ] :=
NIntegrate[
Sech[(h[Omega] - En)/[CapitalGamma]] (1 + 10 En paraConst +
126 (En paraConst)^2)/(1 -
Exp[-2 [Pi] Sqrt[Abs[Eb/(En - Eg)]]]), {En, Eg, [Infinity]}]
elliottFit11 =
NonlinearModelFit[
abs0, {scale (2 Eb^(3/2) Sech[(x - Eg + Eb)/[CapitalGamma]]) +
scale cont3[x, Eb, Eg, [CapitalGamma], b]}, {{Eb, 0.015}, {Eg,
1.59}, {[CapitalGamma], 0.016}, {scale, 7.6}, {b, -0.008}}, x,
MaxIterations -> 100, Weights -> (1/Abs[(abs0[[All, 2]])])]
This is the result considering the first 200 points, which is not too bad. Now I want to fit the whole dataset. The problem here is the fit is extremely slow and I was wondering if you can help me to improve the code somehow. I need to check with many starting parameters and range. Also at some point I have to iterate this fit for many dataset and I would like to improve the quality/speed of the fit. I am using Mathematica 11.3
Thanks
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP