Curve fitting and interpolation

Fit models to measurements and fill in between samples with polyfit, lsqcurvefit, interp1, spline, interp2 and the other fitting functions you already know.

  • Existing MATLAB fitting code runs as written
  • Nonlinear least squares with bounds, with no toolbox to buy
  • Figures zoom and pan, so residuals can be read point by point
  • Free to try, with nothing to install
Download RunMat

Explore the RunMat runtime

The same samples fitted with a degree-6 polynomial and an exponential model, drawn by RunMat from the saved analysis study
Twenty-five noisy samples fitted two ways, drawn by RunMat. The polynomial matches the data and fails past it.

Why use RunMat for curve fitting

No toolbox to buy for lsqcurvefit

Bounded nonlinear fits usually mean paying for an optimization toolbox, or waiting for a shared license to free up. lsqcurvefit and lsqnonlin fit with bounds as part of the RunMat runtime, next to polyfit and interp1, free for individuals, education, research and smaller companies.

Runtime

Fit every sensor in one run

Fitting one curve per sensor, batch or test run in a plain loop keeps a single core busy while the rest sit idle. A parfor loop spreads the fits across every core and returns the same parameters at any worker count.

Parallel

Refit when new data arrives

Each run keeps its script, data and figures, so next week's measurements go through the same fit and the two sets of parameters can be compared side by side.

Desktop app

Review a fit with a colleague

Screenshots of a fit lose the data behind them. Open the project together and both people see the same figures and residuals, with each other's pointer on the plot, while the model changes.

Collaboration

Examples

Degree-2 and degree-6 polynomial fits to the same samples, extrapolated past the last sample, rendered by RunMat

Choose a polynomial degree

Degrees 1 to 6 by R-squared, then both fits past the data.

Noisy decay data with an exponential fit above a stem plot of the residuals, rendered by RunMat

Fit an exponential decay

Amplitude, rate and offset with bounds and 95% intervals.

Linear, spline and pchip interpolation through the same step, with the spline overshooting, rendered by RunMat

Linear, spline or pchip?

Three interpolants across a step, and where spline overshoots.

A sensor calibration line above its residuals inside a shaded 95% prediction band, rendered by RunMat

Calibration with a prediction band

A straight-line fit and where the next reading will fall.

A Gaussian peak with a sloping background fitted to noisy counts, rendered by RunMat

Fit a peak

Center, width and height of a peak on a sloping background.

A filled-contour efficiency map interpolated from 36 measured points, shown as dots, rendered by RunMat

Refine a lookup table

A coarse efficiency map filled in with a 2-D spline.

Try it on your own data

Download RunMat
Read the docs