# Tag Info

5

You could either fit a logistic function (possibly composing it with a linear function), use segmented regression, or classification and regression trees, among other options. The original data, shown in the figure below, was fitted in Gnuplot using the following commands: h(x) = k * 0.5 * (1.0 - tanh(0.5 * (a * x + b))) + c * x + d fit h(x) 'plot-EV.txt' ...

5

In general, you can formulate this as a nonlinear least squares problem. If your values are known at points $(x_{i},y_{i})$, and the known values are $f_{i}$, then you can minimize $\min_{a,b,c,d,e} \sum_{i=1}^{n} \left( f_{i} - a(bx_{i}+c)^{dy_{i}+e} \right)^{2}$ The Levenberg-Marquardt method is commonly used to solve nonlinear least squares problems ...

5

I was surprised for not receiving a satisfactory answer to the question above and my investigations showed me that this, indeed is an unexplored area. Hence, I put some effort in developing solutions to this problem, and published the following manuscripts: T. Birdal, B. Busam, N. Navab, S. Ilic and P. Sturm. "A Minimalist Approach to Type-Agnostic ...

5

The problem is ill-conditioned in the sense that very small changes to the $(y_{i},t_{i})$ data can lead to much larger relative changes in the best fitting parameters. If you do the arithmetic in limited precision (and even IEEE double precision is can be inadequate in practice) then the precision of your floating point arithmetic may not be adequate to ...

5

Chapter 10 of Numerical Analysis (Richard L. Burden, J. Douglas Faires) gives good readable pseudo code for Newtons method. The start parameters are taken from the solution of the linear problem of the log transformed data. (see comment of Christian Clason giving a link (Linear Solution, Mathworld Wolfram) ) while not reached convergence criteria ...

5

Numerical judgement of model choice: You model 36 observations with a model consisting of 12 or 13 predictor variables. This is most likely not a good model. Even if you reach a high $R^2_{adj}$, you most likely model a random pattern. Try to compare a computed $AIC$ (Akaike information criterion) or $BIC$ (Bayesian information criterion) of this model to ...

4

Your problem is ill posed in the sense that if a solution exists, it is not unique. To see this, let ($a_i^*$, $b_i^*$), denote a solution of the equation $F(x_i, a_i,b_i)=y_i$, $i\in\{1,\ldots,N\}$ (or the minimizers of an appropriate cost function if equality cannot be achieved). Then, any pair of functions $\{a^*(x)$, $b^*(x)\}$ such that $a^*(x_i)=a_i^*$,...

4

Let's use the example (approximate the square root function on $[0.25,1.0]$ with a quartic polynomial) to step through your calculations. I suspect that the code is going to work with only modest changes. Having chosen an initial set of six interpolation points: $$x_k = 0.25, 0.4, 0.55, 0.7, 0.85, 1.0\;\; (k=0,\ldots,5)$$ we proceed to interpolate the ...

3

An assortment of curves for fitting chemistry examples is presented in these Colby College class notes. Of particular application is the sigmoid response curve with variable "slope" for the central part of the curve: $$f(x) = \frac{a}{1 + e^{bx - c} } + d$$ [This is similar to the suggested logistic function proposed in the first Answer, but has four ...

3

You could discretize the unknown functions $a$ and $b$, then formulate this as a least squares optimization problem with smoothing regularization. Specifically: $$\min_{\mathbf{a}, \mathbf{b}} \frac{1}{2}\sum_{i=1}^N\left( f_i - F(x_i, \mathbf{m}_i^T \mathbf{a}, \mathbf{m}_i^T \mathbf{b}) \right)^2 + \frac{\alpha}{2} \mathbf{a}^T R \mathbf{a} + \frac{\alpha}... 3 The formula is: m = n + p + 1 m number of knots. n number of control points. p degree. You can check the nurbs book chapter 2 for a complete set of definitions. The Shumaker's book is a more readable reference. There is a paragraph on interpolation also on Tom Lyche and Knut Mørgens's lecture notes. Here you shall find that all the entries in ... 3 I've always relied on physical insights and finding an appropriate nondimensionalization. If your data arises from a physical process where you know the equation or at least the geometry of the problem you may have some luck via the Buckingham pi theorem followed by trial and error. See also this paper: Price, James F. "Dimensional Analysis of Models ... 3 I can report a personal experience on trying to fit fluorescence decays by a sum of two exponentials. We had a quantity of repeated measurements in the same condition, and several different conditions. Non-convexity, and non-uniqueness of the solutions have already been dealt with, the problem is ill-posed, so I will focus here on practical "data" aspects. ... 3 In addition to being ill-posed (as discussed by @BrianBorchers), the problem is also difficult to solve because it is not convex. The original least squares problem is convex because it only contains a sum of squares in the unknowns A,B if a,b are given. But if all four parameters are unknowns, then the exchange A,a \leftrightarrow B,b in four-... 3 Choward already sketched a good approach, I am just going to elaborate. So the equation for a parabola in the plane \mathbb{R}^2 is given by the zero locus of a quadratic equation$$f_a(x,y) = a_{11}x^2 + a_{12}xy + a_{22}y^2 + a_{1}x + a_{2}y + a_{0} = 0,$$where a = (a_{11}, a_{12}, a_{22}, a_{1}, a_{2}, a_{0}) \in \mathbb{R}^6 is the vector of ... 2 There is a approach that uses notions from Discrete Geometry: Discrete Geometry is a discipline that works with objects defined as sets of pixels that try to mimic their standard counterparts. It defines discrete segments, discrete circles, discrete planes etc... In your case, there is an algorithm [1] that has a definition of what a discrete segment is, and ... 2 The Hough Transform is an image processing algorithm for extracting features for an image. The classical version of the algorithm is designed to extract lines from a binary image (such as this). Given the ability to do this, you can make a script fairly easily. Here's one using the hough transform (and associated utilities) in Matlab. It probably requires ... 2 Since you have the Jacobian matrix, you can apply it within a Gauss-Newton or Levenberg-Marquardt method to effectively approximate the Hessian and gradient of your least squares objective function (the gradient is J^{T}f, and the Hessian is to first order J^{T}J.) You could also use the Jacobian to compute the gradient of your least squares ... 2 First of all, you can turn the fitting problem for 1 and 3 into an iterative optimization problem if you don't want to deal directly with solving a large system of equations using a matrix approach. For 2, you can use a hash table and design a spatial hash function to map a coordinate to the appropriate subregion, which would be very fast. For 3, given you ... 2 Fitting the peaks of gamma spectra is a typical task in non-destructive analysis of spent fuel or neutron activation analysis. Since these applications are already "quite old", there is some standard software available, like Genie 2000. A paper Evaluation of Peak-Fitting Software for Gamma Spectrum Analysis from 2015 compares a number of these tools. However,... 1 Is there a reason you considered the Fourier series? It actually seems fairly simple to compute \frac{\partial T}{\partial t} as a piecewise function of t:$$ \frac{\partial T}{\partial t} = \left\{ \begin{matrix} \frac{\partial c}{\partial t} & c(t) > 0 \\ 0 & c(t) < 0 \end{matrix} \right. = \left\{ \begin{matrix} -\frac{2\pi}{\tau} A \...

1

I know of one example where the normals have been included in the fitting procedure. It is not a direct quadric fitting though. A locally parametrized patch is fitted to the points and normals. Using normals gives more equations in the fitting problem, allowing higher order polynomials to be used. A novel cubic-order algorithm for approximating principal ...

1

How does lsqcurvefit estimate error at each iteration of parameter estimation? It both checks how far it has moved (i.e. am I not moving very much anymore? Then stop), and the norm of the gradient (minima are when the gradient is zero). I think there's a third tolerance, "function tolerance", which I don't quite know. It's all here in the docs (search for ...

1

I am quite surprised why no-one mentioned the famous Douglas Peucker Algorithm for polyline simplification. Since you have contour points in hand, you could benefit from it directly. Contour approximation in OpenCV uses this method. See this for usage. and you could also find a MATLAB implementation here or here.

1

You can use some scheme where value at a point is some type of average of its neighboring values. You will have to decide whether this kind of smoothing is appropriate in your case or not. In MATLAB, smooth3 function is used to smooth data in 3D. Using same principle, you can perform Gaussian smoothing or box smoothing in 1D. This is how smoothing is done. ...

1

I have never heard of the need for solving a problem like this, so I am unsure if there's a standard algorithm for your question. Without the need to have points above the parabola, this problem would be a typical least square problem. But due to your constraint, you need to formulate the problem differently. I think there's a number of ways one might ...

1

Assuming that the rectangles do not overlap at all on the $x$ axis, and that the sum of the rectangles should never exceed the value of the original function at any point, the following simple dynamic programming algorithm will calculate the optimal set of at most $k$ rectangles w.r.t. least squared error in $O(n^2k)$ time and $O(nk)$ space in the worst ...

1

This is a more general nonlinear optimization problem than would usually be described as simply "curve fitting". I suggest you approach it as such. You will need to define a few things: The parameters you are optimizing. The quantity to be minimized. Helper functions to simplify things. Matlab has tools that can help and it will help you to break the ...

1

I doubt that such a built-in function exists in MS Excel. Nevertheless, this problem is a linear regression that is simple enough to solve analytically. Let us start with $$\Pi = \sum_{i=1}^{n} \left[y_i - \left(a x_i + b + \frac{c}{x_i}\right)\right]^2 \enspace$$ with $n$ the number of data pairs and $(a,b,c)\equiv (c_1, c_0, c_{-1})$. To find the ...

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