Is there a solution to use "circcirc" with continuous variable as radius?
조회 수: 3 (최근 30일)
이전 댓글 표시
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);
댓글 수: 0
채택된 답변
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
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!