# Tag Info

2

You can get an approximation with NDSolve fairly easily for each of the four branches of the curve for which $y$ is a function of $x$. You can also get symbolic solutions in polar coordinates for each of the two branches for with $\theta$ is a function of $r$ (the reverse of the usual relationship sought). First the polar: eqOP = Rationalize[-(1/2) + ...

2

The following trick sometimes work: f[a_?NumericQ, x_?NumericQ] := Module[{s = ((Sqrt[a] + Sqrt[x + a])^2)^(2/3) - Sqrt[a ((Sqrt[a] + Sqrt[x + a])^2)^(1/3)] - ((Sqrt[a] + Sqrt[a])^2)^(2/3) - Sqrt[a ((Sqrt[a] + Sqrt[a])^2)^(1/3)] + 5}, 10^3 Im@s + Re@s] nlm = NonlinearModelFit[test, {f[a, x]}, {a}, x, ...

4

Here it is with the constraint. I changed the symbols to a,x just for readability (There was nothing wrong with the y,F except that single Caps are good to avoid ) nlm = NonlinearModelFit[ test, {((Sqrt[a] + Sqrt[x + a])^2)^(2/3) - Sqrt[a ((Sqrt[a] + Sqrt[x + a])^2)^(1/3)] - ((Sqrt[a] + Sqrt[a])^2)^(2/3) - Sqrt[a ((Sqrt[a] + ...

2

AFAIK - no. But since you asking. Suppose you have this Data: xdata = {1, 2, 3, 4, 5}; ydata = {1, 2, 3, 4, 5}; and this Errors: err1 = 0.3 err2 = 0.35 Giving you lp1 = ListPlot[{xdata, ydata}, PlotStyle -> Green] and lm = LinearModelFit[Transpose[{xdata, ydata}], x, x] lm["BestFit"] -3.57485*10^-15 + 1. x p1 = Plot[{lm[x]}, {x, maX + ...

24

Fitting an ellipse: i = Import["http://i.stack.imgur.com/W7HJk.jpg"]; lineByCenter[center_, semi_, angle_] := Rotate[Line[{#1 - #2, #1 + #2}], angle, #1]& [center,{0,semi}] sa = 1 /. ComponentMeasurements[ Binarize@i, "SemiAxes"] angle = 1 /. ComponentMeasurements[ Binarize@i, ...

17

If you need more precise calculation you may check this answer. cm = ComponentMeasurements[Binarize@img, "BoundingDiskRadius"] ct = 1 /. ComponentMeasurements[Binarize@img, "BoundingDiskCenter"]; Show[img, Graphics[{Thick, White, Circle[ct, cm[[1, 2]]]}]] {1 -> 63.4933}

1

Update To start you have one data point that needs to be fixed. 7.94834000000012*E-05 -> 7.94834000000012*10^-5. Probably copied from a different format for numbers. Examine the data I am going to use the form from your original question. Using the minus sign in the exponent Jos*(Exp[-Voc/A/n] is not helpful. My understanding is that you have a ...

4

Another approach that might be successful with some additional fine tuning. pos = (pic = Import["http://i.stack.imgur.com/9uBnQ.png"]) // Thinning // PixelValuePositions[#, 1] &; center = Mean /@ Transpose[pos] // N; out = Reap[ Module[{nextPos = {pos[[690]]}, newList = pos, delta = {-1., 1.}, lastPos = {pos[[690]]}}, Do[ ...

4

Not so much of an answer, but an extended comment, but I think I have it very nearly nailed: pos2 = (# - Mean@pos & /@ (N@pos)) // #/Mean@(Norm /@ #) & Manipulate[ Show[ListPlot[Reverse /@ pos2], PolarPlot[Sqrt[a b]/Sqrt[ a^2 Cos[c x]^2 + b^2 Sin[c x]^2], {x, -4.1 \[Pi], 4.1 \[Pi]}, PlotStyle -> Orange]], {a, 1, 15}, {b, 1, 15}, ...

7

This documentation page spells out how EstimatedVariance is computed. It is the "squared sum of FitResiduals divided by the degrees of freedom $n-p$. A linear regression will also have an intercept term, in addition to terms corresponding to each of the predictor columns. For example, headings = ExampleData[{"Statistics", "FisherIris"}, "ColumnHeadings"]; ...

2

Your datatest has one too many parenthesis. Dont use func, replace it with the evaluated integral. Integrate[(a ((x - y)/(1 - y))^2 + b ((x - y)/(1 - y)) + c) (d y^2 + e y + f), {y, 0, x}, Assumptions -> {0 < x < 1}] (* 1/6 x (6 (c f + b (d + e + f) + a (4 d + 3 e + 2 f)) - 3 (-c e + b (d + e) + a (8 d + 5 e + 2 f)) x + (2 a - b + ...

3

You could do for example: int[al_?NumericQ, be_?NumericQ] := NIntegrate[(funcr[al, be, x] - piece[x])^2, {x, 0, 1}] nm = NMinimize[{int[al, be], al >= 1, be >= 1}, {al, be}] Plot[{piece@x, funcr[al, be, x] /. nm[[2]]}, {x, 0, 1}, PlotStyle -> {{Thickness[.01], Red}, {Dashed, Thickness[.01], Blue}}]

3

I am not quite following what you are trying to do with norm or max. The procedure I followed was to make some data from your fake empirical cumulative probability function. piece[x_] := Piecewise[{{x^3, 1 >= x >= 0}, {1, x > 1}}, 0]; data = Table[{x, piece[x]}, {x, 0, 1, 0.02}]; Copy and paste your "model" funcr[al_?NumericQ, be_?NumericQ, ...

11

Because you are implying that you have a random sample of values of $v$ from a specified probability distribution, you should consider using maximum likelihood rather than least squares. (In fact, I must comment that in this forum least squares seems to be often used for the estimation of parameters given a random sample which I would argue is almost never ...

7

numHist = numHist/Tr@numHist/vHist[[2]] // N; data = Transpose[{MovingAverage[vHist, 2], numHist}]; m = 5.99736*10^-13;(*particle mass in kg*) k = 1.3806488*10^-23;(*Boltzmann constant in J/K*) model = m/(k*T)*v*Exp[-m*v^2/(2*k*T)]; fit = FindFit[data, model, {{T, 10}}, v] modelf = Function[{v}, Evaluate[model /. fit]]; Plot[modelf[t], {t, 0, 0.0009}, Epilog ...

0

Thanks to Jack for the answer, it was helpful. I have been thinking about what I really need to find, and so just would like to re-state my question better and also to show what were my attemps (only partially successful) to solve things on my own. I am trying to find a fit to the distribution function (empiricial data) in terms of a function which is ...

0

I have tried to implement all advices, but somehow it is still does not work. Here is the code. I must have been missing something gravely... ClearAll[a, b, c, x, g4, f4, dis] g4[x_?NumericQ] := a ChebyshevT[2, x] + b ChebyshevT[4, x] f4[x_?NumericQ] := Exp[x]^(1/2) + 2 - Exp[x] + x^5 dis[a_?NumericQ, b_?NumericQ, c_?NumericQ, x_] := Norm[f4[x] - g4[x], ...

4

Fit works using singular value decomposition. FindFit uses the same method for the linear least-squares case, the Levenberg–Marquardt method for nonlinear least-squares, and general FindMinimum methods for other norms. - source NonlinearModelFit allows fitting of weighted data, as J.M. commented Edit: The best fit parameters are a property of the ...

5

A common approach is to blank/mask out the signal and fit a polynomial to the remaining data. A problem to avoid here is overfitting, i.e. fitting some high-order polynomial to the noise structure. Taking the artifical data from Vitaliy's answer: f[x_] := Exp[-(x - 7)^2] + Exp[-(x + 5)^2] - .002 x^2 data = Table[{x, f[x] + .1 RandomReal[{-1, 1}]}, {x, ...

10

So imagine you do not know the background formula. This can be done in a beautiful way with FindFormula. Generate data: f[x_] := Exp[-(x - 7)^2] + Exp[-(x + 5)^2] - .002 x^2 data = Table[{x, f[x] + .1 RandomReal[{-1, 1}]}, {x, -15, 15, .1}]; Plot[f[x], {x, -15, 15}, PlotRange -> All, Epilog -> {Red, Point[data]}] Now use FindFormula to learn ...

4

If you know the number of Gaussians, you can proceed as follows. Here is data with a single Gaussian added to a quadratic with noise: mydata = Table[ {n, .01 n^2 + 40 PDF[NormalDistribution[10, 1], n] + 3 RandomReal[]}, {n, 1, 40}]; Here's a non-linear model of the assumed form but unknown constants: nlm = NonlinearModelFit[ mydata, {a n^2 + b ...

3

One can gain insight into a problem of this sort by using a forward model with known parameters and running FindFit (or something similar) with perfect data. When we integrate your equation Integrate[(a1 ((x - y)/(1 - y))^2 + b1 ((x - y)/(1 - y)) + k1) (a2 y^2 + b2 y + k2), {y, 0, x}] the solution is 1/6 x (6 (b1 (a2 + b2) + (b1 + k1) k2 + a1 (4 a2 ...

Top 50 recent answers are included