Tag Info

New answers tagged

0

data = Table[{x, Exp[.2 + .3 x + .1 Sin[x] + RandomReal[{-.2, .2}]]}, {x, RandomReal[5, 100]}]; nlm = NonlinearModelFit[data, Exp[a + b Sin[x] + c Cos[x]], {a, b, c}, x]; pt = nlm["ParameterTable"]; You can also use Part as follows to access the row labels, column labels and the content of pt: rowlabels = Sequence[1, 1, 2 ;;, 1]; collabels ...


0

Drop[(%["ParameterTable"] // First // First)[[All, 1]], 1]


3

Assuming you have typed fit = NonlinearModelFit[{{0, 1}, {1, 2}, {3, 3}}, a + b*x, {a, b}, x] Using this great answer you can type StringProperties[NonlinearModelFit] ...


1

From the documentation, StepMonitor is an option for iterative numerical computation functions that gives an expression to evaluate whenever a step is taken by the numerical method used. Meanwhile, EvaluationMonitor is an option for various numerical computation and plotting functions that gives an expression to evaluate whenever functions ...


3

You're only providing y-values to FindFit, with so Mathematica has no knowledge of the x-values and has to assume them to be integers starting from 1. You can change this by doing xydata = Transpose[{Datax, Datay}] to generate a list of x-y pairs for the model to fit to. The fitting can then be carried out as before: xydata = Transpose[{Datax, Datay}]; ...


0

Are we colleagues, by any chance? Anyway, there's a well known closed-form expression for eps1. Rather than doing the very costly NIntegrate to get eps1 from eps2 (which is reevaluated many, many times during the execution of NonLinearModelFit, I suggest you write down the analytical expression for eps1. For the form of eps2 that you show here, you can ...


3

This problem is solved by lowering the coefficient of the weight decay term. When I was first try to implement it, I was using lambda = 2, since in the tutorial, lambda can be any positive number. I tried lambda = 1/20, 1/30, until 1/50. When lambda = 1/50, I got very good result. theoreticalResult[[All, -1]] diff = theoreticalResult[[All, -1]] - ...


0

you can remove the large value like this: ListPlot[ Select[ data , Abs[#[[2]]]<10^4& ] , Joined->True]


1

shows that the figure at 12 is much larger than the others that is correct. It is because the data at that location is much larger than the others. You can limit the plot range as follows data = RandomReal[{0, 1}, 20]; data[[10]] = 10^14; (*insert large point*) ListPlot[data, Joined -> True, PlotRange -> All] Now using specific plot range ...


2

The standard approach for determining maximum likelihood with binned data is to determine the probability of an observation being in each bin given the functional form of the distribution. These probabilities are either found by summing individual probabilities of the discrete elements within a bin or by integrating from the lower to upper limit of each bin ...


0

The following works quite well: k = 1 - a/(b - x^2 - I*c*x); t = Table[{x, k /. {a -> 10, b -> 5, c -> 2}}, {x, 1, 50}]; FindFit[t, {k, (a | b | c) ∈ Reals}, {a, b, c}, x, NormFunction -> (Norm@## &)] (* {a -> 9.99976, b -> 4.99994, c -> 1.99994} *)


8

You may use NMinimize[] on the results of ParametricNDSolve[] like this: g = 9.81; m = 10; rho = 1.225; Cd = 0.5; A = 0.1; rcd = rho Cd A; vMax = 40; EndTime[theta_] := (2 vMax Sin[theta])/g + 5; sol[Ux_, Uy_, Uz_] := Quiet@ParametricNDSolve[{ m z''[t] == -m g - Tanh[z'[t]] 1/2 rcd (z'[t] - Uz)^2, z[0] == 0, z'[0] == v Cos[theta], m ...



Top 50 recent answers are included