How should I use the function Circfit ?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
채택된 답변
From the help section of that file,
% x,y are column vector where (x(i),y(i)) is a measured point
Their class are double.
They are column vectors of any length but must have the same length between x and y.
Demo
Here's a demo; see the inline comments to understand each step.
First, compute noisy circle coordinates for the demo.
% Create noisy circle coordinates
radius=3;
theta=linspace(0,2*pi,200);
theta(randi(numel(theta),1,190)) = []; % remove some data
x=radius*cos(theta);
y=radius*sin(theta);
% add noise
x = x + (rand(size(x))-0.5)*radius/4;
y = y + (rand(size(y))-0.5)*radius/4;
% Plot it
plot(x,y,'o')
axis equal
Do the fitting but you have to fill in the inputs. The reason I'm not telling you what the inputs should be is not to cause frustration but to get you to think about this. Again, the two inputs are column vectors of your x and y coordinates of each point you're fitting.
% Fit it
[xc,yc,R,a] = circfit(___, ___); % FILL IN THE INPUTS HERE
% [update: here's the solution: [xc,yc,R,a] = circfit(x, y);
Now you can use the outputs to compute the fitted circle and plot it.
% compute circle based on fit params
theta=linspace(0,2*pi,200);
xFit=R*cos(theta) + xc;
yFit=R*sin(theta) + yc;
% add fit
hold on
plot(xc,yc,'rx') % plot circle center
plot(xFit,yFit, 'r-')

댓글 수: 9
farzad
2020년 1월 9일
What length ? if I have to find the circumcircle of 3 points with their x and y , how do I write the command ?
x and y would be the x and y values of the 3 points. So, they would have length 3 if you only have 3 points.
Try it. If it doesn't work, show me what inputs you tried and I can help straighten it out.
farzad
2020년 1월 9일
I'm asking if I have 3 coordinates what should I put instead of circLocs
[centerLoc, circleNormal, radius] = CircFit3D(circLocs)
should I do
[centerLoc, circleNormal, radius] = CircFit3D(x1,y1,x2,y2,x3,y3) ?
if not , please write the line, I don't get it from the incomplete documentation, and nothing on internet
The syntax is
[xc,yc,R,a] = circfit(x,y)
where x and y are column vectors describing the x and y points along the circumference.
You said you have 3 (x,y) coordinates. So x and y each have 3 elements.
I've gotten that from the documentation which I would not call 'incomplete'.
farzad
2020년 1월 9일
what do you mean ? shall you please write it , how you understood ? are you sure it works ?
I don't understand your definitions, please write the line, why are you making me wait for longer time ?
I have already exhausted my guesses, if you know, why are you refraining ?
Adam Danz
2020년 1월 9일
I've updated my answer, see the demo I've provided.
farzad
2020년 1월 9일
why a vector? and how can the vector length be the same for different points?
I justice don't get it
Run my example. The x and y variables are vectors and together they are the coordinates of each noisy point along the cirlce. They are the variables you are fitting.
If you are only fitting 3 points, then your x vector will have 3 values (the x value for each point) and your y vector will have 3 values (the y value for each point).
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Language Support에 대해 자세히 알아보기
참고 항목
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
