Tag Info

Hot answers tagged

13

Something strange happens when you allow your lines in your model to have a gap at point k. You also specified UnitStep functions wrongly - see my version below. You do realize your model function allows for gap? It is better to have less parameters in the model. Obviously your data assume that lines meet without gap. Why not to explicitly specify this ...


5

Its not func0[a] that is the problem; it's the compound expression you've given NMinimize to chew (look up the true meaning of ;). This compound expression is not a _?NumericQ function of a, so Mathematica can't tell that it is only valid for numeric values of a. Try: func1[a_?NumericQ] := (var = func0[a]; Print[var]; {aa, bb} = var.{1/Sqrt[2], ...


5

There is actually a fair bit going on here that can make this confusing. The critical thing is the difference between testing fit to a family of distributions compared to testing fit to a particular distribution. Let me demonstrate. SeedRandom[23]; data = RandomVariate[NormalDistribution[1, 2], 100]; DistributionFitTest[data, NormalDistribution[mu, ...


4

Here is a solution -- I added a constraint and manually found some good initial values. g[z_] = Simplify[ 5 Log[10,(1 + z ) Integrate[1/(a + b x + c x^2), {x, 0, z}] ] + 25 , Assumptions -> {z > 0, -b^2 + 4 a c > 0 }] 5 (5 + Log[10,-((2 (1 + z) (ArcTan[b/Sqrt[-b^2 + 4 a c]] - ArcTan[(b + 2 c ...


4

As b.gatessucks comments you can use inset. You can also use PlotLegends and customize, e.g. tab = nlm["ParameterTable"] plt = Show[ Plot[nlm[t], {t, 0, 5}, PlotRange -> Full, PlotLegends -> Placed[LineLegend[{Blue}, {Normal@nlm[t]}, LegendMarkerSize -> {50, 3}, LegendFunction -> (Column[{#, tab}, Frame -> True] ...


4

As usual, it's a matter of choosing a better starting values for the parameters. I started writing this answer before the data file was uploaded, so here's some synthetic data: data = Table[ Interpolation[{{0, 1.1*^-6}, {200, 1.1*^-6}, {250, 9.5*^-7}, {500, 9.5*^-7}}, x, InterpolationOrder -> 1] + 2*^-8 ...


3

Following @Vitaliy's comment try this formulation: kB = QuantityMagnitude@ UnitConvert[Quantity["BoltzmannConstant"] , "Joule/Kelvin"] pdf[dp_?NumericQ, d0p_?NumericQ, w_?NumericQ] = kB^(-1/3)/(w Sqrt[2 Pi]) 1/dp *E^(-1/(2 w^2) (Log[dp /d0p])^2); mt[b_?NumericQ, Nt_?NumericQ, Ms_?NumericQ, d0p_?NumericQ, w_?NumericQ] := Nt kB^(4/3) Ms Pi /6 ...


2

You can try to improve it "by hand", as follows. Assume that the model is like this: model = (a*(Exp[c*t] - 1))/(1 + b*Exp[c*t]) and assume that you have in mind that your data correspond to {{1, intensity1}, {2, intensity2},...} (see my comment above) and assume that norm is the name of your data. Try the following: Clear[model, a, b, c]; model = ...


2

Your model seems to be problematic. With a standard step-shaped model: ´model = a/(1 + b*Exp[-c (x - d)])´ you immediately find a simple enough solution. Assuming that ´lst´ is your list try this: model = a/(1 + b*Exp[-c (x - d)]); ff = FindFit[lst, model, {a, b, c, d}, x] (* {a -> 1.00153, b -> 0.437, c -> 13.2399, d -> 0.454211} *) This ...



Only top voted, non community-wiki answers of a minimum length are eligible