## Hot to locate indices of 2-D data located out of circle?

### Abdulaziz Abutunis (view profile)

on 17 Nov 2019 at 6:22
Latest activity Commented on by Abdulaziz Abutunis

### Abdulaziz Abutunis (view profile)

on 18 Nov 2019 at 17:38

### Walter Roberson (view profile)

Dear All,
I have x,y data that are extracted from a triangle solution. I wonder if there is a command (no loop) that will find the indices of elements when x^2+y^2 > than a specific value. The reason I want to eliminate them.
Thank you
Aziz

### Walter Roberson (view profile)

on 17 Nov 2019 at 6:33

vector_of_y_values = (1:number_of_rows) - y_center;
vector_of_x_values = (1:number_of_columns) - x_center;
[Yg, Xg] = ndgrid(vector_of_y_values, vector_of_x_values);
idx = find(Xg.^2 + Yg.^2 > specific_value);

Show 1 older comment
Abdulaziz Abutunis

### Abdulaziz Abutunis (view profile)

2019 年 11 月 17 日 17:01
I have not used the ndgrid and used the next line. Also, I made a mathematical mistake in the previous script by forgetting the square root
ind_remove = find(sqrt(x.^2 + y.^2) > percentage_added);
Though your answer will do what i want if not using the ndgrid
Thanks
Walter Roberson

### Walter Roberson (view profile)

2019 年 11 月 17 日 19:02
I forgot to account for possible scale factors such as the possibility that the x coordinates are percentage. The x and y vectors should be constructed so that they list the x and y coordinates, such
linspace(firstx, lastx, number of x)
Abdulaziz Abutunis

### Abdulaziz Abutunis (view profile)

2019 年 11 月 18 日 17:38
Thank you, Walter, for your valuable suggestions