ValientProcess
ValientProcess

Reputation: 1801

Removing extreme values from a Matrix in MATLAB

I have a matrix with x-y data points:

A= [x1 , y1; x2 , y2; x3 , y3]

and i want to remove selected points (rows) that their y value is above some deviation from the average.

How can i do this ?

Thank you, Ron

Upvotes: 0

Views: 1622

Answers (2)

lakshmen
lakshmen

Reputation: 29064

A(A(:,2) > mean(A(:,2) + ScaleFactor*std(A(:,2)),:) = [];

ScaleFactor will depend on what your criteria is..

Upvotes: 0

Dennis Jaheruddin
Dennis Jaheruddin

Reputation: 21563

Here is what you seem to need:

A(abs(A(:,2)-mean(A(:,2)))>treshold,:) = []

If you want you can let the treshold be something like

1.234*std(A(:,2))

Upvotes: 4

Related Questions