Tag Info

Hot answers tagged

5

You can use NonlinearModelFit instead of FindFit. dt = Table[Prime[x], {x, 20}]; FindFit[dt, a x Log[b + c x], {a, b, c}, x] (* {a -> 1.42076, b -> 1.65558, c -> 0.534645} *) nlm = NonlinearModelFit[dt, a x Log[b + c x], {a, b, c}, x]; Normal[nlm] (* 1.42076 x Log[1.65558+0.534645 x]*) nlm["ParameterTable"] Grid[Transpose[{#, nlm[#]} ...


4

On the borderline of comment and answer: I've found it helpful to read the error messages carefully. They contain important information specific to your problem. These are telling you that b x+a x^2+c[T] is not a number when a number is substituted for x. In particular, a and b are nonnumeric symbols. It's complicated why the symbol T is present -- it ...


4

Too long for a comment: ClearAll[x, y, a, b, c, T, z, data2, X] y[a_, b_, x_, T_] := a*x^2 + b*x + c[T]; c[T_?NumericQ] := Piecewise[{{0, T == 1}, {1, T == 2}, {-1, T == 3}, {Indeterminate, True}}]; z[X_?NumericQ, T_?NumericQ, a_?NumericQ, b_?NumericQ] := NIntegrate[y[a, b, x, T], {x, 0, X}]; data2 = {{0, 1, 0.0178038}, {1, 1, 1.34999}, {2, 1, 6.6659}, {3, ...


3

As the error says, the variable info that you are referring to does not exist in the R workspace. What you need to do is transfer the data from Mathematica to R. One way is to create the variables x1, x2 and y in R using RSet data = {{"x1", "x2", "y"}, {0, 2, 1}, {1, 5, 0}, {3, 3, 2}, {5, 9, 4}, {3, 4, 5}, {7, 10, 7}}; RSet[First[#], Rest[#]] & /@ ...


3

Well in the particular case of a BinormalDistribution there are plenty of tests available for the individual hypotheses. SeedRandom[124]; data = RandomVariate[BinormalDistribution[{1, 2}, {1/3, 4}, 3/4], 1000]; To test the mean vector.. LocationTest[data, {1, 2}] (* 0.174306 *) The variances can only be tested independently since there is no ...


3

Before posting the solution I found, let me reformulate the problem and give more details about what I am trying to acheive. A Robotic arm grabs a turbine blade. All the robot positional data is available and the blade geometry as well. I need to find the exact position of the blade relative to the grabber, using positional information provided as a point ...


2

With the functions given in the question above: Pressing the plus sign in the interpolation function object will expand the description to include the method. sol = NDSolve[eqs, {n, S}, {t, 0, 60*10^-9}, MaxSteps -> 10^6] The problem is not the iterator range but rather the initial number of PlotPoints. PlotPoints -> n specifies the total number ...


2

Your data: data = {{0.067, 0.423}, {0.30, 0.408}, {0.60, 0.433}, {0.25, 0.3512}, {0.37, 0.4602}, {0.44, 0.413}, {0.60, 0.390}, {0.73, 0.437}, {0.8, 0.47}}; errors = {0.055, 0.0552, 0.0662, 0.0583, 0.0378, 0.080, 0.063, 0.072, 0.08}; ErrorListPlot[Transpose[{data, ErrorBar /@ errors}], PlotRange -> {0, 1}] Assume that the errors are distributed ...


2

I am answering my own question after a suggestion by MichaelE2 Here is a second version of dfit (dfit4) which has Sliders and TrackedSymbols. The sliders are a method of finding appropriate initial conditions. The solution to the problem is to include TrackedSymbols in the Dynamic that calculates the NonLinearModelFit. ClearAll[dfit4]; dfit4[data_] := ...


2

First, some slight changes to orbita: orbita[a_?NumberQ, b_?NumberQ, c_?NumberQ, d_?NumberQ, e_?NumberQ] := (orbita[a, b, c, d, e] = {X[t], Y[t]} /. First@NDSolve[{Vx'[t] == (-e*G*X[t]*Msun)/(X[t]^2 + Y[t]^2)^(3/2), Vy'[t] == (-e*G*Y[t]*Msun)/(X[t]^2 + Y[t]^2)^(3/2), X'[t] == Vx[t], Y'[t] == Vy[t], Vx[0] == a, Vy[0] == b, ...


1

data = {{1, 1, 4}, {1, 3, 4}, {2, 1, 4}, {2, 3, 3}, {3, 7, 4}, {3, 3, 2}}; expr = a*x + b*y + c*x*y + d*y^2 + e; f[x_, y_] = expr /. FindFit[data, expr, {a, b, c, d, e}, {x, y}] // Rationalize // Simplify (1/4)*(17 - 2*x*(-1 + y) - 2*y + y^2) data[[All, 3]] == f @@@ data[[All, 1 ;; 2]] True For your second data set, ...


1

Perhaps this is enough for you: d1 = Transpose[{#[[1]] - #[[1, 1]], #[[2]]} &@ Transpose@Select[data, #[[2]] > 0 &]]; nlm = NonlinearModelFit[d1, c PDF[BetaDistribution[3, b], x], {b, c}, x]; Plot[nlm[x], {x, 0, .003}, PlotRange -> All, Epilog -> Point@d1] Another option: nlm = NonlinearModelFit[d1, c PDF[MoyalDistribution[.0002, b], ...


1

This seems to come close. The idea is to find factors, at all levels, that are not numeric and are independent of the variable. Set up replacement rules for these in terms of some new symbol. Do the replacement. I also return the rules used in case that might be useful. replaceFactors[expr_, x_, c_Symbol] := Module[ {e2 = MapAll[Collect[#, x] &, ee], ...



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