Using (x-a) ^ 2 + (y-b) ^ 2 = r ^ 2, the values ​​of a, b and r are known. How do I find x and y values?

2 ビュー (過去 30 日間)
busra dogru
busra dogru 2019 年 4 月 11 日
コメント済み: Torsten 2019 年 4 月 15 日
I know the values ​​a, b and r. (x-a) ^ 2 + (y-b) ^ 2 = r^2 providing the formula I want to calculate the x and y points . Thank you in advance for your help.

回答 (1 件)

Torsten
Torsten 2019 年 4 月 11 日
theta = linspace(0,2*pi,100);
x = a + r*cos(theta);
y = b + r*sin(theta);
plot(x,y)
  8 件のコメント
busra dogru
busra dogru 2019 年 4 月 14 日
Hello again. I can calculate x and y points with your code. I'm trying to check if these points are in the binary image. I get the following error when I run the following code;
[b, a] = find(newImage);
A = [a, b];
[m,n] = size(A);
B = 1;
t = 1;
while(t<51)
for p=1:m
while(B==1)
theta = linspace(0,2*pi);
x = A(p,1) + round(t*cos(theta));
y = A(p,2) + round(t*sin(theta));
x = x';
y = y';
if x == 0
x = 1;
end
if y == 0
y = 1;
end
B = A(x,y);
t = t+1;
end
end
end
disp(x,y);
Subscript indices must either be real positive integers or logicals.
Error in Untitled18 (line 79)
B = A(x,y);
What can I do to solve this error? Thanks in advance ..
Torsten
Torsten 2019 年 4 月 15 日
x and y are vectors of doubles of the same size as "theta" - so the setting B = A(x,y) doesn't make sense.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDiscrete Data Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by