%
% Symbolic code for the hybrid motor
%
syms u np th d l l0 l1 du dl dd udut ulut idq id iq ...
     tm psi0 ud delta udldqudt ifg ifc ig tm k real
%
u=[cos(np*th) sin(np*th);-sin(np*th) cos(np*th)];
d=[cos(np*th);sin(np*th)];
l=[l0+l1*cos(2*np*th) l1*sin(2*np*th);l1*sin(2*np*th) ...
   l0-l1*cos(2*np*th)];
du=diff(u,th);dd=diff(d,th);dl=diff(l,th);
udut=simplify(u*du')
ulut=simplify(u*l*u')
idq=[id;iq];
tm=simplify(psi0*idq'*u*dd+0.5*idq'*u*dl*u'*idq)