Dear all,

I already do some calculation using Matlab. When I calculate dh1 dot sigma2, I got the answer but when dh2 dot delta2 , an error occur because of not same matrix size. What should I do to solve it?

syms xdot xddot thetadot thetaddot ydot yddot x y z phi theta psi

f=[xdot;0;thetadot;0;ydot;(xdot*tan(theta)-ydot)];
F=[xdot;1;thetadot;0;ydot;(xdot*tan(theta)-ydot)+tan(theta)];
g1=[0;1;0;0;0;tan(theta)];
g2=[0;0;0;1;0;0];
vars=[x,xdot, theta, thetadot,y, ydot];

fg1=jacobian(g1,vars)*f-jacobian(f,vars)*g1;
Fg2=jacobian(g2,vars)*F-jacobian(F,vars)*g2;
F2g2=jacobian(Fg2,vars)*F-jacobian(F,vars)*Fg2;
F3g2=jacobian(F2g2,vars)*F-jacobian(F,vars)*F2g2;


h1=[x;0;0;0;0;0]; % h1 = x
h2=[0;0;0;0;y;0]; % h2 = y

fh1=jacobian(h1,vars)*f-jacobian(f,vars)*h1 %Lfh1
f2h1=jacobian(fh1,vars)*f-jacobian(f,vars)*fh1 %L2fh1 = 0

c51=dot(diff(h1),fg1) % = -1
c52=dot(diff(h2),F3g2) % = not equal to 0

sigma2=[g1];
c61=dot(diff(h1),sigma2) %dh1 dot sigma2

but how to calculate dh2 dot delta2 , if
% delta2=span{g2, Fg2, F2g2}

Thank you.