Select values from meshgrid that fit a constraint.

I have a meshgrid like
[x,y] = meshgrid(-10:0.1:10);
and I want to select all values from that meshgrid such that . How can I do this?

 Accepted Answer

KSSV
KSSV on 29 Aug 2020
Edited: KSSV on 29 Aug 2020
[x,y] = meshgrid(-10:0.1:10);
d = x.^2+y.^2 ;
idx = abs(d-1)<=10^-3 ;
iwant = [x(idx) y(idx)]
plot(x,y,x',y') ;
hold on
plot(x(idx),y(idx),'*r')

1 Comment

Hi, What if I want a new meshgrid from the above found iwant coordinates.
I want to use the output for streamslice function.

Sign in to comment.

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Tags

Asked:

on 29 Aug 2020

Edited:

on 23 Mar 2023

Community Treasure Hunt

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

Start Hunting!