版块导航
正在加载中...
客户端APP下载
登录
注册
帖子
帖子
用户
本版
应《网络安全法》要求,自2017年10月1日起,未进行实名认证将不得使用互联网跟帖服务。为保障您的帐号能够正常使用,请尽快对帐号进行手机号验证,感谢您的理解与支持!
24小时热门版块排行榜
>
论坛更新日志
(4533)
>
论文投稿
(829)
>
文献求助
(352)
>
导师招生
(220)
>
虫友互识
(169)
>
硕博家园
(157)
>
考博
(140)
>
学术会议
(101)
>
休闲灌水
(84)
>
招聘信息布告栏
(53)
>
博后之家
(49)
>
健康生活
(44)
>
教师之家
(34)
>
绿色求助(高悬赏)
(33)
>
公派出国
(23)
>
考研
(22)
小木虫论坛-学术科研互动平台
»
计算模拟区
»
仿真模拟
»
MATLAB
»
matllab中空间圆如何拟合?
5
1/1
返回列表
查看: 5163 | 回复: 9
只看楼主
@他人
存档
新回复提醒
(忽略)
收藏
在APP中查看
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖
zhhhero
铜虫
(初入文坛)
应助: 0
(幼儿园)
金币: 137.9
帖子: 25
在线: 16.8小时
虫号: 1201795
注册: 2011-02-11
性别: GG
专业: 统计学其他学科
[
求助
]
matllab中空间圆如何拟合?
求大侠,帮忙,如何在matlab中最小二乘法拟合空间圆,求出圆心,半径。最好有matlab程序,谢谢
回复此楼
» 猜你喜欢
售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急
已经有3人回复
浙江教授:国内知名学者要尽量少发论文,尽量只研究卡脖子问题-别人做不了的研究
已经有4人回复
售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急
已经有4人回复
我的“飞艇+直升机”专利中了VFS的TVF 2027,求高校师生带写论文并参会
已经有3人回复
售SCI一区文章,我:8.O.55.1.O.54,科目齐全,可伽急
已经有8人回复
售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急
已经有8人回复
售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急
已经有12人回复
售SCI一区文章,我:8.O.55.1.O.54,科目齐全,可伽急
已经有6人回复
售SCI文章,我:8O.5.5.1O.54,科目全,可十急
已经有3人回复
售SCI一区T0P文章,我:8.O.55.1.O.5.4,科目全,可+急
已经有3人回复
» 本主题相关价值贴推荐,对您同样有帮助:
【求助】哪款软件可以拟合Pbnm空间群?
已经有3人回复
学到老,活到老
1楼
2013-05-01 23:54:25
已阅
回复此楼
关注TA
给TA发消息
送TA红花
TA的回帖
zhhhero
铜虫
(初入文坛)
应助: 0
(幼儿园)
金币: 137.9
帖子: 25
在线: 16.8小时
虫号: 1201795
注册: 2011-02-11
性别: GG
专业: 统计学其他学科
引用回帖:
2楼
:
Originally posted by
change0618
at 2013-05-02 09:22:48
可以去matlab App中心下载
function = circfit(x,y)
%
% = circfit(x,y)
%
% fits a circle in x,y plane in a more accurate
% (less prone to ill condition )
% procedure than circfit2 ...
大侠,给的程序是三点确定空间圆,能否对8个点,拟合空间圆给出思路呢。谢谢
赞
一下
回复此楼
高级回复
学到老,活到老
9楼
2013-05-02 22:49:09
已阅
回复此楼
关注TA
给TA发消息
送TA红花
TA的回帖
查看全部 10 个回答
change0618
铁杆木虫
(著名写手)
方丈大师
应助: 44
(小学生)
金币: 17724.5
红花: 17
帖子: 2413
在线: 546.7小时
虫号: 496517
注册: 2008-01-19
专业: 化学反应工程
【答案】应助回帖
★ ★
感谢参与,应助指数 +1
xiegangmai: 金币+2, 谢谢参与!
2013-05-02 23:10:37
可以去matlab App中心下载
CODE:
function [xc,yc,R,a] = circfit(x,y)
%
% [xc yx R] = circfit(x,y)
%
% fits a circle in x,y plane in a more accurate
% (less prone to ill condition )
% procedure than circfit2 but using more memory
% x,y are column vector where (x(i),y(i)) is a measured point
%
% result is center point (yc,xc) and radius R
% an optional output is the vector of coeficient a
% describing the circle's equation
%
% x^2+y^2+a(1)*x+a(2)*y+a(3)=0
%
% By: Izhak bucher 25/oct /1991,
x=x(:); y=y(:);
a=[x y ones(size(x))]\[-(x.^2+y.^2)];
xc = -.5*a(1);
yc = -.5*a(2);
R = sqrt((a(1)^2+a(2)^2)/4-a(3));
CODE:
%try_circ_fit
%
% IB
%
% revival of a 13 years old code
% Create data for a circle + noise
th = linspace(0,2*pi,20)';
R=1.1111111;
sigma = R/10;
x = R*cos(th)+randn(size(th))*sigma;
y = R*sin(th)+randn(size(th))*sigma;
plot(x,y,'o'), title(' measured points')
pause(1)
% reconstruct circle from data
[xc,yc,Re,a] = circfit(x,y);
xe = Re*cos(th)+xc; ye = Re*sin(th)+yc;
plot(x,y,'o',[xe;xe(1)],[ye;ye(1)],'-.',R*cos(th),R*sin(th)),
title(' measured fitted and true circles')
legend('measured','fitted','true')
text(xc-R*0.9,yc,sprintf('center (%g , %g ); R=%g',xc,yc,Re))
xlabel x, ylabel y
axis equal
CODE:
function [center,rad,v1n,v2nb] = circlefit3d(p1,p2,p3)
% circlefit3d: Compute center and radii of circles in 3d which are defined by three points on the circumference
% usage: [center,rad,v1,v2] = circlefit3d(p1,p2,p3)
%
% arguments: (input)
% p1, p2, p3 - vectors of points (rowwise, size(p1) = [n 3])
% describing the three corresponding points on the same circle.
% p1, p2 and p3 must have the same length n.
%
% arguments: (output)
% center - (nx3) matrix of center points for each triple of points in p1, p2, p3
%
% rad - (nx1) vector of circle radii.
% if there have been errors, radii is a negative scalar ( = error code)
%
% v1, v2 - (nx3) perpendicular vectors inside circle plane
%
% Example usage:
%
% (1)
% p1 = rand(10,3);
% p2 = rand(10,3);
% p3 = rand(10,3);
% [center, rad] = circlefit3d(p1,p2,p3);
% % verification, result should be all (nearly) zero
% result(:,1)=sqrt(sum((p1-center).^2,2))-rad;
% result(:,2)=sqrt(sum((p2-center).^2,2))-rad;
% result(:,3)=sqrt(sum((p3-center).^2,2))-rad;
% if sum(sum(abs(result))) < 1e-12,
% disp('All circles have been found correctly.');
% else,
% disp('There had been errors.');
% end
%
%
% (2)
% p1=rand(4,3);p2=rand(4,3);p3=rand(4,3);
% [center,rad,v1,v2] = circlefit3d(p1,p2,p3);
% plot3(p1(:,1),p1(:,2),p1(:,3),'bo');hold on;plot3(p2(:,1),p2(:,2),p2(:,3),'bo');plot3(p3(:,1),p3(:,2),p3(:,3),'bo');
% for i=1:361,
% a = i/180*pi;
% x = center(:,1)+sin(a)*rad.*v1(:,1)+cos(a)*rad.*v2(:,1);
% y = center(:,2)+sin(a)*rad.*v1(:,2)+cos(a)*rad.*v2(:,2);
% z = center(:,3)+sin(a)*rad.*v1(:,3)+cos(a)*rad.*v2(:,3);
% plot3(x,y,z,'r.');
% end
% axis equal;grid on;rotate3d on;
%
%
% Author: Johannes Korsawe
% E-mail: johannes.korsawe@volkswagen.de
% Release: 1.0
% Release date: 26/01/2012
% Default values
center = [];rad = 0;v1n=[];v2nb=[];
% check inputs
% check number of inputs
if nargin~=3,
fprintf('??? Error using ==> cirlefit3d\nThree input matrices are needed.\n');rad = -1;return;
end
% check size of inputs
if size(p1,2)~=3 || size(p2,2)~=3 || size(p3,2)~=3,
fprintf('??? Error using ==> cirlefit3d\nAll input matrices must have three columns.\n');rad = -2;return;
end
n = size(p1,1);
if size(p2,1)~=n || size(p3,1)~=n,
fprintf('??? Error using ==> cirlefit3d\nAll input matrices must have the same number or rows.\n');rad = -3;return;
end
% more checks are to follow inside calculation
% Start calculation
% v1, v2 describe the vectors from p1 to p2 and p3, resp.
v1 = p2 - p1;v2 = p3 - p1;
% l1, l2 describe the lengths of those vectors
l1 = sqrt((v1(:,1).*v1(:,1)+v1(:,2).*v1(:,2)+v1(:,3).*v1(:,3)));
l2 = sqrt((v2(:,1).*v2(:,1)+v2(:,2).*v2(:,2)+v2(:,3).*v2(:,3)));
if find(l1==0) | find(l2==0), %#ok<OR2>
fprintf('??? Error using ==> cirlefit3d\nCorresponding input points must not be identical.\n');rad = -4;return;
end
% v1n, v2n describe the normalized vectors v1 and v2
v1n = v1;for i=1:3, v1n(:,i) = v1n(:,i)./l1;end
v2n = v2;for i=1:3, v2n(:,i) = v2n(:,i)./l2;end
% nv describes the normal vector on the plane of the circle
nv = [v1n(:,2).*v2n(:,3) - v1n(:,3).*v2n(:,2) , v1n(:,3).*v2n(:,1) - v1n(:,1).*v2n(:,3) , v1n(:,1).*v2n(:,2) - v1n(:,2).*v2n(:,1)];
if find(sum(abs(nv),2)<1e-5),
fprintf('??? Warning using ==> cirlefit3d\nSome corresponding input points are nearly collinear.\n');
end
% v2nb: orthogonalization of v2n against v1n
dotp = v2n(:,1).*v1n(:,1) + v2n(:,2).*v1n(:,2) + v2n(:,3).*v1n(:,3);
v2nb = v2n;for i=1:3,v2nb(:,i) = v2nb(:,i) - dotp.*v1n(:,i);end
% normalize v2nb
l2nb = sqrt((v2nb(:,1).*v2nb(:,1)+v2nb(:,2).*v2nb(:,2)+v2nb(:,3).*v2nb(:,3)));
for i=1:3, v2nb(:,i) = v2nb(:,i)./l2nb;end
% remark: the circle plane will now be discretized as follows
%
% origin: p1 normal vector on plane: nv
% first coordinate vector: v1n second coordinate vector: v2nb
% calculate 2d coordinates of points in each plane
% p1_2d = zeros(n,2); % set per construction
% p2_2d = zeros(n,2);p2_2d(:,1) = l1; % set per construction
p3_2d = zeros(n,2); % has to be calculated
for i = 1:3,
p3_2d(:,1) = p3_2d(:,1) + v2(:,i).*v1n(:,i);
p3_2d(:,2) = p3_2d(:,2) + v2(:,i).*v2nb(:,i);
end
% calculate the fitting circle
% due to the special construction of the 2d system this boils down to solving
% q1 = [0,0], q2 = [a,0], q3 = [b,c] (points on 2d circle)
% crossing perpendicular bisectors, s and t running indices:
% solve [a/2,s] = [b/2 + c*t, c/2 - b*t]
% solution t = (a-b)/(2*c)
a = l1;b = p3_2d(:,1);c = p3_2d(:,2);
t = 0.5*(a-b)./c;
scale1 = b/2 + c.*t;scale2 = c/2 - b.*t;
% centers
center = zeros(n,3);
for i=1:3,
center(:,i) = p1(:,i) + scale1.*v1n(:,i) + scale2.*v2nb(:,i);
end
% radii
rad = sqrt((center(:,1)-p1(:,1)).^2+(center(:,2)-p1(:,2)).^2+(center(:,3)-p1(:,3)).^2);
赞
一下
(1人)
回复此楼
2楼
2013-05-02 09:22:48
已阅
回复此楼
关注TA
给TA发消息
送TA红花
TA的回帖
zhhhero
铜虫
(初入文坛)
应助: 0
(幼儿园)
金币: 137.9
帖子: 25
在线: 16.8小时
虫号: 1201795
注册: 2011-02-11
性别: GG
专业: 统计学其他学科
对了,我是有10组空间点三维坐标,现在想拟合空间圆。
赞
一下
回复此楼
学到老,活到老
3楼
2013-05-02 09:58:24
已阅
回复此楼
关注TA
给TA发消息
送TA红花
TA的回帖
dbb627
荣誉版主
(著名写手)
专家经验: +4
仿真EPI: 6
应助: 289
(大学生)
贵宾: 0.589
金币: 24640.4
散金: 551
红花: 61
沙发: 1
帖子: 1246
在线: 1794.8小时
虫号: 149791
注册: 2005-12-29
性别: GG
专业: 污染控制化学
管辖:
计算模拟
【答案】应助回帖
★
感谢参与,应助指数 +1
xiegangmai: 金币+1, 谢谢参与!
2013-05-02 23:10:45
空间圆的点必然共面,将空间坐标转到平面坐标下,拟合后再转回去。
赞
一下
回复此楼
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
4楼
2013-05-02 10:23:35
已阅
回复此楼
关注TA
给TA发消息
送TA红花
TA的回帖
查看全部 10 个回答
如果回帖内容含有宣传信息,请如实选中。否则帐号将被全论坛禁言
普通表情
龙
兔
虎
猫
百度网盘
|
360云盘
|
千易网盘
|
华为网盘
在新窗口页面中打开自己喜欢的网盘网站,将文件上传后,然后将下载链接复制到帖子内容中就可以了。
最具人气热帖推荐
[查看全部]
作者
回/看
最后发表
[
公派出国
]
售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急
+3
2SluGOjKYlTo
2026-11-29
3/150
2026-11-30 21:38
by
LUPbBdty0o0X
[
硕博家园
]
售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急
+4
N80hyqiqCeT2
2026-11-26
4/200
2026-11-28 10:47
by
Equinoxhua
[
基金申请
]
我的“飞艇+直升机”专利中了VFS的TVF 2027,求高校师生带写论文并参会
+3
95217
2026-11-26
3/150
2026-11-28 10:04
by
kudofaye
[
博后之家
]
售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急
+3
jE6DD3S4jsZB
2026-11-27
3/150
2026-11-27 19:30
by
FlRlcTrDsDoO
[
考博
]
售SCI一区文章,我:8.O.55.1.O.54,科目齐全,可伽急
+3
J9NGDvAaPB9L
2026-11-27
3/150
2026-11-27 18:46
by
XTPLXDTeEwbs
[
教师之家
]
售SCI一区文章,我:8.O.55.1.O.54,科目齐全,可伽急
+6
Gp6vMAD5C53H
2026-11-26
7/350
2026-11-27 17:54
by
HaAiYedD27eq
[
找工作
]
售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急
+5
Gp6vMAD5C53H
2026-11-26
6/300
2026-11-27 17:52
by
HaAiYedD27eq
[
教师之家
]
售SCI一区T0P文章,我:8.O.55.1.O.54,科目齐全,可+急
+3
Gp6vMAD5C53H
2026-11-26
4/200
2026-11-27 17:47
by
HaAiYedD27eq
[
公派出国
]
售SCI文章,我:8O.5.5.1O.54,科目全,可十急
+5
mzU8LdVQMwOf
2026-11-26
5/250
2026-11-27 17:47
by
HaAiYedD27eq
[
博后之家
]
售SCI文章,我:8O.5.5.1O.54,科目全,可十急
+4
mzU8LdVQMwOf
2026-11-26
4/200
2026-11-27 17:30
by
HaAiYedD27eq
[
公派出国
]
售SCI一区T0P文章,我:8.O.55.1.O.5.4,科目全,可+急
+5
1VHV9UkX7sid
2026-11-26
5/250
2026-11-27 17:19
by
HaAiYedD27eq
[
教师之家
]
售SCI一区T0P文章,我:8.O.55.1.O.5.4,科目全,可+急
+6
1VHV9UkX7sid
2026-11-26
7/350
2026-11-27 17:15
by
HaAiYedD27eq
[
博后之家
]
售SCI一区T0P文章,我:8.O55.1.O.54,科目全,可十急
+5
1VHV9UkX7sid
2026-11-26
7/350
2026-11-27 17:07
by
HaAiYedD27eq
[
硕博家园
]
售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急
+3
N80hyqiqCeT2
2026-11-26
4/200
2026-11-27 13:33
by
aTZfRIGzowsS
[
考研
]
售SCI一区T0P文章,我:8.O.55.1.O.5.4,科目全,可+急
+4
Gp6vMAD5C53H
2026-11-26
5/250
2026-11-27 13:19
by
aTZfRIGzowsS
[
考研
]
售SCI一区文章,我:8.O.551.O.5.4,科目全,可伽急
+4
1VHV9UkX7sid
2026-11-26
4/200
2026-11-27 12:38
by
aTZfRIGzowsS
[
考博
]
售SCI文章,我:8O5.5.1.O.54,科目齐全,可+急
+6
1VHV9UkX7sid
2026-11-26
7/350
2026-11-27 12:24
by
aTZfRIGzowsS
[
硕博家园
]
售SCI文章,我:8O.5.5.1O.54,科目全,可十急
+5
1VHV9UkX7sid
2026-11-26
9/450
2026-11-27 08:08
by
YSq3swkeEVgo
[
考研
]
售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急
+3
mzU8LdVQMwOf
2026-11-26
3/150
2026-11-27 05:50
by
p1TifTPkqG3A
[
考博
]
申博求助
10
+3
charles.ww
2026-11-24
6/300
2026-11-26 21:27
by
13961805515
信息提示
关闭
请填处理意见
关闭
确定