Is there a solution to use "circcirc" with continuous variable as radius?

2 ビュー (過去 30 日間)
Miro Mitev
Miro Mitev 2016 年 8 月 10 日
コメント済み: Miro Mitev 2016 年 8 月 10 日
Hello, I am trying to implement trilateration algorithm and I am using "circcirc" command to find intersections of the circles.
My problem is: I need to find intersections of circles, which changes their radius every step but they have the same centers. Is it possible without re-writing the command or with another command?
This is my code:
Center1=[0.75,5];
Center2=[6.98,4.31];
Center3=[3.46,1.48];
radii1=[1; 3; 4];
radii2=[2.5; 3; 2.3];
radii3=[3; 1; 5];
[x_intersection1_2,y_intersection1_2] = circcirc(Center1(:,1),Center1(:,2),radii1,Center2(:,1),Center2(:,2),radii2);
[x_intersection1_3,y_intersection1_3] = circcirc(Center1(:,1),Center1(:,2),radii1,Center3(:,1),Center3(:,2),radii3);
[x_intersection2_3,y_intersection2_3] = circcirc(Center2(:,1),Center2(:,2),radii2,Center3(:,1),Center3(:,2),radii3);

採用された回答

Pawel Ladosz
Pawel Ladosz 2016 年 8 月 10 日
Hi Miro,
You may want to use for or while loops. Please find description here. The exact code would vary depending on which radius you want to change at what time.
  6 件のコメント
Pawel Ladosz
Pawel Ladosz 2016 年 8 月 10 日
yes, I made a mistake regarding the number of outputs of function. x and y are now 2x3 matrix where each row is a different coordinate and each column different radius. Let me know whether it works now.
Center1=[0.75,5];
Center2=[6.98,4.31];
Center3=[3.46,1.48];
radii1=[1, 3, 4];
radii2=[2.5, 3, 2.3];
radii3=[3, 1, 5];
%initialize them as 2 by 3 rather than 1 by 4
x1_2=zeros(2,3);
y1_2=zeros(2,3);
x1_3=zeros(2,3);
y1_3=zeros(2,3);
x2_3=zeros(2,3);
y2_3=zeros(2,3);
for n = 1:3
[x1_2(:,n),y1_2(:,n)] = circcirc(Center1(:,1),Center1(:,2),radii1(n),Center2(:,1),Center2(:,2),radii2(n));
[x1_3(:,n),y1_3(:,n)] = circcirc(Center1(:,1),Center1(:,2),radii1(n),Center3(:,1),Center3(:,2),radii3(n));
[x2_3(:,n),y2_3(:,n)] = circcirc(Center2(:,1),Center2(:,2),radii2(n),Center3(:,1),Center3(:,2),radii3(n));
end
Miro Mitev
Miro Mitev 2016 年 8 月 10 日
Thanks a lot. Yes it is working this time perfectly.
I have fixed it by the way bellow but your approach is much more simple.
[c,c1] = circcirc(Center2(:,1),Center2(:,2),radii2(n),Center3(:,1),Center3(:,2),radii3(n));
x2_3(1,n)=c(1);
y2_3(1,n)=c1(1);
x2_3(2,n)=c(2);
y2_3(2,n)=c1(2);

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by