"Wayne King" <wmkingty@gmail.com> wrote in message <i9mfh5$ent$1@fred.mathworks.com>...
> "John M" <ioannis.mitsos@gmail.com> wrote in message <i9mb2m$3k3$1@fred.mathworks.com>...
> > Hello,
> >
> > I have two vectors X and Y, indicating coordinates in a 2D area. The coordinates are data produced from a lab experiment and due to some test 'flows' the data at the first and final rows of the vectors are rubbish.
> >
> > For this reason I'd like to get the best fit line of the X,Y data considering only the correct values of X,Y.
> >
> > Although, I know how to plot the best fit line I have no clue how to make a script which will plot the best fit lines without selecting the abnormal values at the beginning and end of the X,Y vectors.
> >
> > Y =
> >
> > 1.0e+003 *
> >
> > [0
> > 0.5507
> > 0.7049
> > 0.8575
> > 0.9369
> > 0.9714
> > 1.0741
> > 1.1516
> > 1.1522
> > 1.2884
> > 1.3553
> > 1.4259
> > 1.4928
> > 1.5671
> > 1.6217
> > 1.8308
> > 1.8759
> > 2.0196
> > 2.1183
> > 2.1904
> > 2.3120
> > 2.4620
> > 2.5070
> > 2.6033
> > 2.7051
> > 2.8088
> > 2.8965
> > 3.0408
> > 3.0816
> > 3.0658
> > 3.0978
> > 3.1260
> > 3.1788
> > 3.2146
> > 3.2340];
> >
> >
> > P2=[0.11
> > 1.878
> > 3.208
> > 4.1822
> > 4.5927
> > 4.8798
> > 5.453
> > 6.003
> > 6.1
> > 6.872
> > 7.345
> > 7.803
> > 8.2533
> > 8.7478
> > 9.1838
> > 10.624
> > 10.926
> > 11.905
> > 12.593
> > 13.018
> > 13.975
> > 14.761
> > 15.292
> > 15.803
> > 16.521
> > 17.2447
> > 17.869
> > 18.4158
> > 19.2046
> > 19.0946
> > 19.3159
> > 19.4739
> > 19.8323
> > 20.023
> > 20.203];
>
> Hi John, If your answer to Ross's appropriate question is that you'd like a more general way to exclude outliers from the regression line, the Statistics Toolbox has a nice routine for this called robustfit().
>
> Wayne
Hi Wayne,
Thanks a lot, this function does exactly what I want to do!
Very helpful comment. Thanks
John
