matlab,integral,best-fit-curve

The integral function requires its second and third arguments to be scalars. If you want to build the array dT of integrals over the limits contained in the array sT (or silkingT—your reported error is not consistent with the provided code), use in the definition of function km: dT =...

Here's a fairly naive implementation of a function that minimises SS(a,b,r) from that paper: fitSS <- function(xy, a0=mean(xy[,1]), b0=mean(xy[,2]), r0 = mean(sqrt((xy[,1]-a0)^2 + (xy[,2]-b0)^2)), ...){ SS <- function(abr){ sum((abr[3] - sqrt((xy[,1]-abr[1])^2 + (xy[,2]-abr[2])^2))^2) } optim(c(a0,b0,r0), SS, ...) } I've written a couple of supporting functions to generate random data on...

matlab,regression,curve-fitting,ellipse,best-fit-curve

You can also try with fminsearch, but to avoid falling on local minima you will need a good starting point given the amount of coefficients (try to eliminate some of them). Here is an example with a 2D ellipse: % implicit equation fxyc = @(x, y, c_) c_(1)*x.^2 + c_(2).*y.^2...

r,ggplot2,curve-fitting,best-fit-curve,curvesmoothing

Using some mock data from ggplot2 stat_smooth examples since you didn't provide any. You'll need to do some math on the resultant data.frame calculated by stat_smooth: library(ggplot2) library(splines) library(MASS) p1 <- ggplot(mtcars, aes(qsec, wt)) p2 <- p1 + stat_smooth(method = "lm", formula = y ~ ns(x,3)) + geom_point() gb <-...

matlab,curve-fitting,best-fit-curve

The thing you drawn in black by hand is not a parabola. It doesn't follow y=a*x^2+b equation thus you can not fit it. It actually follows y=±sqrt(a*x)+b . I am not sure if you can fit a function to this equation (actually they are 2 equations). What you can do,...

matlab,math,curve-fitting,least-squares,best-fit-curve

If A is of full rank, i.e. the columns of A are linearly independent, the least-squares solution of an overdetermined system of linear equations A * x = b can be found by inverting the normal equations (see Linear Least Squares): x = inv(A' * A) * A' * b...

python-2.7,scipy,curve-fitting,outliers,best-fit-curve

You are most probably speaking about recursive regression (which is quite easy in Matlab). For python, try and use the scipy.optimize.curve_fit. For a simple 3 degree polynomial fit, this would work based on numpy.polyfit and poly1d. import numpy as np import matplotlib.pyplot as plt points = np.array([(1, 1), (2, 4),...