Curve fitting tool - extract modified data
2 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone,
I'm using the curve fitting tool for linear regression and to remove outliers for my data.
Below is an example of what I'm trying to do.
How can I recieve the new data for y where the one outier identified has been removed?
Thanks
xdat = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10]
ydat = [ 100; 85; 66; 50; 40; 70; 25; 20; 15; 2]
%scatter(xdat,ydat)
f = fittype( 'poly1' );
% Fit model to data.
fit1 = fit( xdat, ydat, f);
% Link with code: https://de.mathworks.com/help/curvefit/removing-outliers.html
fdata = feval(fit1,xdat);
%Set standard deviation to 0.5
% Identifies outliers with deviation from baseline model
I = abs(fdata - ydat) > 0.5*std(ydat);
outliers = excludedata(xdat,ydat,'indices',I);
% refit model to data with outliers excluded
fit2 = fit(xdat,ydat,f, 'Exclude',outliers)
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!