필터 지우기
필터 지우기

How to remove outliers from a set of 2D points?

조회 수: 11 (최근 30일)
Hadi Ghahremannezhad
Hadi Ghahremannezhad 2020년 10월 1일
댓글: Hadi Ghahremannezhad 2020년 10월 1일
My question has two parts:
  1. I have two 1D arrays containing X and Y values. How can I create another 1D array where each element is a 2D point?
  2. How to remove outliers from the resulting array?
For example, something like this:
x = [1 3 2 4 2 3 400];
y = [2 3 1 4 2 1 500];
xy = [[1 2] [3 3] [2 1] [4 4] [2 2] [3 1] [400 500]];
result = rmoutliers(xy, 'mean');
The result should look like:
result = [[1 2] [3 3] [2 1] [4 4] [2 2] [3 1]]
  댓글 수: 2
John D'Errico
John D'Errico 2020년 10월 1일
Arrays in MATLAB are not composed of multiple elements in every element. Those extra square brackets were meaningless.
For example, this just creates a row vector of length 14.
xy = [[1 2] [3 3] [2 1] [4 4] [2 2] [3 1] [400 500]];
Better is to use a 2 dimensional array. Thus
xy = [1 2;3 3;2 1;4 4;2 2;3 1;400 500];
xy =
1 2
3 3
2 1
4 4
2 2
3 1
400 500
As you can see, I dropped the spurious brackets.
Anyway, a number is just a symbol. It has no intrinsic meaning unless you put some meaning to the symbol. In this case, I might consider each row as representing the (x,y) coordinates of a point in 2-dimensions.
Hadi Ghahremannezhad
Hadi Ghahremannezhad 2020년 10월 1일
Thanks, I wanted to use 2D array, but the rmoutliers does not work the way I want with 2D matrix.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by