Tag Info

Hot answers tagged

23

The following is based on the fact that the determinant of a matrix is equal to zero when two rows are the same. Thus, if you plug any of the points in, you get a true statement. SeedRandom[3]; pts = RandomReal[{-1, 1}, {5, 2}]; row[{x_, y_}] := {1, x, y, x*y, x^2, y^2}; eq = Det[Prepend[row /@ pts, row[{x, y}]]] == 0 (* Out: ...


10

The general equation of ellipse (here) is given by: ellipse[x_, y_] = a x^2 + b x y + c y^2 + d x + e y + f == 0; solving using 5 pintos result in: SeedRandom[3]; pts = RandomReal[{-1, 1}, {5, 2}]; sol = Solve[ellipse @@@ pts]; ellipse[x, y] /. sol[[1]] // Simplify (*a (-0.275185 + 1. x^2 + x (0.189022 + 0.566953 y) + 0.1281 y + 0.397124 y^2) == ...


9

Major update, version 2.0 What changed: Is a different, more clever way of solving the problem. Overcomes most of the issues of previous versions. Problem summary: I will rephrase the problem in simplest terms. There exests a named curve called limacon (french, pronounced [ˈlɪməsɒn], means snail), described by a simple equation $r=a+b\cos{\theta}$ in ...


5

Use NonlinearModelFit and put in the best guess parameters from your Manipulate. data = {0.316228, -0.316228, 0.316228, -0.316228, 0.316228, -0.316228, 0.316228, -0.316228, 0.316228, -0.316228, 0.316228} eqn[x_] := a Sin[b x + c] nlm = NonlinearModelFit[data, eqn[x], {{a, 0.4}, {c, -1}, {b, 3.1}}, x] Plot[nlm[x] /. fit, {x, 1, 11}, Epilog -> ...


4

Why not try to fit some functions to your three datasets? Using Fit we can fit e.g. polynomials of degree 10 as follows: FitPolynomial[data_] := Fit[data, Table[x^n, {n, 0, 10}], x]; {f1, f2, f3} = FitPolynomial /@ {yy1, yy2, yy3}; We can then combine the three functions f1, f2, and f3 into a single function f with PieceWise: f = Piecewise @ { {f1, 0 ...


3

Here is a Fourier Basis approach: ClearAll[FourierBasis2D]; FourierBasis2D[{numx_, numy_}, {λx_, λy_}, x_, y_] := N[With[{ωn = 2 π/λx, ωm = 2 π/λy}, Flatten[ {1}~Join~ Table[ {Cos[ n ωn x] Cos[m ωm y], Cos[ n ωn x] Sin[ m ωm y], Sin[ n ωn x] Cos[m ωm y], Sin[ n ωn x] Sin[ m ωm y]}, {n, numx}, {m, ...


3

Just an extended comment to start. I'll try to follow up with some code later today or over the weekend. This sounds like a perfect job for a Laguerre Filter and most likely an adaptive one, e.g., Laguerre Filters – An Introduction. You can find lots of info on this online. The Laguerre Filter smooths a data set based on Laguerre polynomials. Its first ...


2

Here's a rather ham-fisted approach using GaussianFilter: First, a filtering function: filter[data_, threshold_, r_] := Module[{datatemp = Transpose@data, pos = Flatten@Position[data[[All, 2]], x_ /; x >= threshold]}, datatemp[[2, pos]] = GaussianFilter[datatemp[[2, pos]], r]; Transpose@datatemp ] This function applies a Gaussian filter to all ...



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