i have a set of 10 point of circle
1.For each three successive points , calculate the radius of the circle passing through these points
2. using this points i have to find three points having the maximum radius, then remove the middle point from set
3.for all points repeat steps 1 and 2 until only three points remain
i have the formula for finding radius but i cannot solve the 2 & 3 step.

댓글 수: 5

Jijo Ninan
Jijo Ninan 2011년 3월 15일
can it be solved with nested function or subfuction
Jan
Jan 2011년 3월 15일
We cannot and will not solve your homework, but assistence is likely, if you post what you have done so far and which problems occur.
Jijo Ninan
Jijo Ninan 2011년 3월 15일
This is what i have done but next three steps i am stuck up
function[Oxi,Oyi,Ri,PCx,PCy]= Rough(a,b,c,d,e,a1,b1,c1,d1,e1,x1,y1,x2,y2,x3,y3,x4,y4,x5,y5)
% calculate the center of the circle
%circle coordiantes three points (x1,y1)(x2,y2)(x3,y3)
%coordinates of center of circle
a=y3-y1;
b=y2-y1;
c=x2-x1;
d=x3-x1;
e=y3-y1;
a1=y3+y1;
b1=y2+y1;
c1=x2+x1;
d1=x3+x1;
e1=x3-x2;
fprintf('co-ordinates of center of the circle are ')
Oxi=(a*(c*c1+b*b1)-b*(d*d1+a*a1)/(2*(c*e-b*e1)));
Oyi=(c*(d*d1+a*a1)-d*(c*c1+b*b1)/(2*(c*e-b*e1)));
%Radius of circle;
Ri=sqrt((x1-Oxi)^2)+((y1-Oyi)^2);
disp('radius of a circle');
disp(Ri);
arra=[x1,x2,x3,x4,x5];
arra2=[y1,y2,y3,y4,y5];
meanx=mean(arra);
meany=mean(arra2);
disp('mean of x values');
disp(meanx);
disp('mean of y values');
disp(meany);
PCx=meanx;
PCy=meany;
plot(x1,y1,x2,y2,x3,y3,x4,y4,x5,y5);
for calling the function
fileName='C:\Users\Jijo\Desktop\MATLAB1\import.xls'
a=xlsread(fileName);
x1=a(1,1)
x2=a(2,1)
x3=a(3,1)
y1=a(1,2)
y2=a(2,2)
y3=a(3,2)
x4=a(4,1)
y4=a(4,2)
x5=a(5,1)
y5=a(5,2)
a=y3-y1;
b=y2-y1;
c=x2-x1;
d=x3-x1;
e=y3-y1;
a1=y3+y1;
b1=y2+y1;
c1=x2+x1;
d1=x3+x1;
e1=x3-x2;
[Oxi,Oyi,Ri,PCx,PCy]= Rough(a,b,c,d,e,a1,b1,c1,d1,e1,x1,y1,x2,y2,x3,y3,x4,y4,x5,y5)
Jan
Jan 2011년 3월 15일
Please insert the code by editing your original messge.
Walter Roberson
Walter Roberson 2011년 3월 18일
I can't tell if step #1 is to be applied over the entire list first, and then step #2 is to eliminate one of the points, then apply step #1 to all of the reduced list, and so on?
Or is step #1 to be applied to the first 3 points, then one of those removed by step #2, then one more point added from the original 10, then remove 1, and so on?

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

답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

질문:

2011년 3월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by