Curve fitting tool - extract modified data
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Interpolation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!