马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
m程序运行后,出现如下警告:
Conditioning of Gradient Poor - Switching To LM method
Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 2.141438e-016.
> In optim\private\nlsq at 269
In fsolve at 300
In calibrationtest_all_simu070614 at 50
接下来还有很多同样的Warning.
程序如下:大家看看怎么解决。谢谢了!
clear
format long
encoder=load('calibration_070610test.txt');
[rencoder,lencoder]=size(encoder);
%计算螺母距关节轴的长度及转角
for i=1:rencoder
p(i,1)=(encoder(i,1))/(4096*7)*10+y(1);
p(i,2)=(encoder(i,2))/(4096*7)*16+y(2);
theta(i,1)=acos((y(9)^2+y(11)^2-(p(i,1))^2)/(2*y(9)*y(11)))+y(7)+y(4);
theta(i,2)=2.5*pi-theta(i,1)-y(8)-acos((y(10)^2+y(12)^2-(p(i,2))^2)/(2*y(10)*y(12)));
m(i,1)=y(3)+y(5)*sin(theta(i,1))+y(6)*sin(theta(i,1)+theta(i,2));
end
save mtest m -ascii
%******************************标定仿真
clear
%载入测量点在测量系统中的相对z坐标值和相应测量点对应的各关节编码器读数。
encoder=load('calibration_070610test.txt');
[rencoder,lencoder]=size(encoder)
load('mtest')
for i=1:rencoder
p(i,1)=sym(encoder(i,1))/(4096*7)*10+'x(1)';
p(i,2)=sym(encoder(i,2))/(4096*7)*16+'x(2)';
theta(i,1)=acos((sym('x(9)')^2+sym('x(11)')^2-(p(i,1))^2)/(2*sym('x(9)')*sym('x(11)')))+sym('x(7)')+sym('x(4)');
theta(i,2)=2.5*pi-theta(i,1)-sym('x(8)')-acos((sym('x(10)')^2+sym('x(12)')^2-(p(i,2))^2)/(2*sym('x(10)')*sym('x(12)')));
z(i)=sym('x(5)')*sin(theta(i,1))+sym('x(6)')*sin(theta(i,1)+theta(i,2))+'x(3)'-mtest(i,1);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fun=inline(z);
%设定迭代初值
x0=[360 600 630 0.012 1540 2300 0.4939 0.6871 442.94 504.48 320 400];
%进行迭代计算标定。
myoptions=optimset('LevenbergMarquardt','ON','NonlEqnAlgorithm','gn','MaxIter',10000,'TolFun',1e-5,'MaxFunEvals',50000);
x=fsolve(fun,x0,myoptions); |