Interactive polynomial fitting
h = polytool(...)
polytool(x,y) fits a line to the vectors x and y and displays an interactive plot of the result in a graphical interface. You can use the interface to explore the effects of changing the parameters of the fit and to export fit results to the workspace.
This example shows how to start an interactive fitting session with polytool.
Generate data from a quadratic curve with added noise.
rng('default') % for reproducibility x = -5:5; y = x.^2 - 5*x - 3 + 5*randn(size(x));
Fit a quadratic (degree-2) model with 0.90 confidence intervals.
n = 2; alpha = 0.1; polytool(x,y,n,alpha)