马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
我的程序老是出错,但不知道怎么修改。
请高手指导指导。程序如下:
syms x y z
syms u v w g
l1 = 1; l2 = 1; l3 = 1;
t = 0:100;
% delta
delta = 0.0024*sin(8.2078*t);
ddelta = 0.02*cos(8.2078*t);
dddelta = -0.1642*sin(8.2078*t);
pd1 = 1.5+0.5*cos(2*pi*t);
pd2 = 1.5+0.5*sin(2*pi*t);
pd = [pd1,pd2]';
dpd1 = -pi*sin(2*pi*t);
dpd2 = pi*cos(2*pi*t);
dpd = [dpd1,dpd2]';
ddpd1 = -2*pi*pi*cos(2*pi*t);
ddpd2 = -2*pi*pi*sin(2*pi*t);
ddpd = [ddpd1,ddpd2]';
p1 = l1*cos(x)+l2*cos(x+y)+l3*cos(x+y+z)-delta*sin(x+y+z);
p2 = l1*sin(x)+l2*sin(x+y)+l3*sin(x+y+z)+delta*cos(x+y+z);
p = [p1,p2]';
dp1 = -l1*u*sin(x)-l2*(u+v)*sin(x+y)-l3*(u+v+w)*sin(x+y+z)-delta*(u+v+w)*cos(x+y+z);
dp2 = l1*u*cos(x)+l2*(u+v)*cos(x+y)+l3*(u+v+w)*cos(x+y+z)-delta*(u+v+w)*sin(x+y+z);
dp = [dp1,dp2]';
ep = pd-p;
dep = dpd-dp;
% kv,kp
kp = 40*eye(2);
kv = 12*eye(2);
Jr = [-l1*sin(x)-l2*sin(x+y)-l3*sin(x+y+z)-delta*cos(x+y+z),-l2*sin(x+y)-l3*sin(x+y+z)-delta*cos(x+y+z),-l3*sin(x+y+z)-delta*cos(x+y+z);
l1*cos(x)+l2*cos(x+y)+l3*cos(x+y+z)-delta*sin(x+y+z),l2*cos(x+y)+l3*cos(x+y+z)-delta*sin(x+y+z),l3*cos(x+y+z)-delta*sin(x+y+z)];
dJr = [-l1*u*cos(x)-l2*(u+v)*cos(x+y)-l3*(u+v+w)*cos(x+y+z)-ddelta*cos(x+y+z)+delta*(u+v+w)*sin(x+y+z),-l2*(u+v)*cos(x+y)-l3*(u+v+w)*cos(x+y+z)-ddelta*cos(x+y+z)+delta*(u+v+w)*sin(x+y+z),-l3*(u+v+w)*cos(x+y+z)-ddelta*cos(x+y+z)+delta*(u+v+w)*sin(x+y+z);
-l1*u*sin(x)-l2*(u+v)*sin(x+y)-l3*(u+v+w)*sin(x+y+z)-ddelta*sin(x+y+z)-delta*(u+v+w)*cos(x+y+z),-l2*(u+v)*sin(x+y)-l3*(u+v+w)*sin(x+y+z)-ddelta*sin(x+y+z)-delta*(u+v+w)*cos(x+y+z),-l3*(u+v+w)*sin(x+y+z)-ddelta*sin(x+y+z)-delta*(u+v+w)*cos(x+y+z)];
Jf = [-sin(x+y+z);cos(x+y+z)];
dJf = [-(u+v+w)*cos(x+y+z);-(u+v+w)*sin(x+y+z)];
Jr1 = pinv(Jr);
% equation
% ddtheata = J
J = Jr1*(ddpd+kv*dep+kp*ep-dJr*[u,v,w]'-Jf*ddelta-dJf*ddelta);
dx = u;
dy = v;
dz = w;
du = J(1);
dv = J(2);
dw = J(3);
du=du(:);
dg=1; % g = t;
Ja = jacobian([u;v;w;J(1);J(2);J(3);g], [x,y,z,u,v,w,g])
错误提示如下:
??? Error using ==> sym.svd
Too many input arguments.
Error in ==> pinv at 29
[U,S,V] = svd(A,0);
Error in ==> pinv at 27
X = pinv(A',varargin{:})';
Error in ==> ex1_jacobian at 65
Jr1 = pinv(Jr);
请教-------------------- |