How to find different coordinates from an array that satisfies the equation of circle?
1 view (last 30 days)
Show older comments
I am trying to find multiple values of x and y coordinates from an array that satisfies the equation of circle? a = 2; b = 2; r = 2; A = [1:100; 1:100] C(:,2) = A((A(:,1)-a).^2+(A(:,2)-b).^2==r^2,:)
I am not able to define the the variable C such that it gives me multiple values satisfying the equation
Thank you in advance
0 Comments
Answers (1)
John D'Errico
on 23 May 2018
Edited: John D'Errico
on 23 May 2018
This:
A = [1:100; 1:100]
does NOT generate combinations of those values in a grid.
a = 2;b=2;r = 2;
[A,B] = meshgrid(1:100,1:100);
[I1,I2] = find((A - a).^2 + (B - b).^2 == r.^2)
I1 =
4
2
I2 =
2
4
Different values for a, b, and r will potentially generate more solutions.
0 Comments
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!