I have the equation of a circle:
(x - a)^2 + (y - b)^2 - r^2 = 0
a, b and r are known values and I would like to find the values of x and y from a predetermined coordinate matrix which satisfies the equation.
example: a = 2, b = 2, r = 2
A = 1 2
1 3
2 4
4 2
The coding to do this is:
a = 2; b = 2; r = 2;
B = A((A(:,1)-a).^2+(A(:,2)-b).^2==r^2,:);
then the last two values would satisfy and hence display 2,4 and 4,2.
What I would like to know is how this code would change if i set limits. Say I want to display only the value that is within the limits of +/-1 for a & b.
i.e. it would only display 2,4

답변 (1개)

Image Analyst
Image Analyst 2014년 8월 26일

0 개 추천

Do you want to create a ring/torus/annulus? If so, see the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_an_ring.3F

댓글 수: 4

Duncan
Duncan 2014년 8월 26일
no i don't. what I am doing is related to the distance of a line between 2 points. I have the coordinates of one point and the distance. I just want to find the 2nd coordinate point which matches but within a limit
Image Analyst
Image Analyst 2014년 8월 26일
For a given point, and a distance, there are an infinite number of points. I don't know what the "limit" is - if it's a box bounded by some x,y coordinates, or a sector bounded by some angles, or a point in some arbitrarily shaped region, or whatever. Please upload a diagram that illustrates the situation with an example.
Duncan
Duncan 2014년 8월 26일
The "2nd coordinate value" can be found in matrix "A". what i mean by 'limit' is to set a limit on the coordinate points to be displayed that is within matrix A
Image Analyst
Image Analyst 2014년 8월 26일
Maybe I'm just dense but that means nothing to me, but a diagram would help me immensely.

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

카테고리

도움말 센터File Exchange에서 Interpolation에 대해 자세히 알아보기

태그

질문:

2014년 8월 26일

댓글:

2014년 8월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by