| Curve Fitting Toolbox | ![]() |
Specify data to be excluded from a fit
Syntax
Arguments
Description
outliers = excludedata(xdata,ydata, identifies data to be excluded from a fit using the specified 'MethodName',MethodValue)
MethodName and MethodValue. outliers is a logical vector containing 1's marking data points to exclude while fitting, and 0's marking data points to include while fitting. The data exclusion methods are given below.
Remarks
You can combine data exclusion methods using logical operators. For example, to combine methods using the | (OR) operator
outliers = excludedata(xdata,ydata,'indices',[3 5]); outliers = outliers|excludedata(xdata,ydata,'box',[1 10 0 90]);
In some cases, you might want to use the ~ (NOT) operator to specify a box that contains all the data to exclude.
Example
Generate random data in the interval [0, 15], create a sine wave with noise, and add two outliers with the value 2.
rand('state',0); x = 15*rand(150,1); y = sin(x) + (rand(size(x))-0.5)*0.5; y(ceil(length(x)*rand(2,1))) = 2;
Identify outliers that are outside the interval [-1.5, 1.5] using the range method.
Identify the same outliers using the indices method.
You can pass outliers to the fit function to exclude the specified data points from a fit.
See Also
| disp | feval | ![]() |