syms x(t) y(t) phi(t) dx(t) dy(t) dphi(t) ddx(t) ddy(t) ddphi(t)
K = 0.5*(m0*(vv0.'*vv0) + Itot*dphi^2);
K = subs(K, diff(x, t), dx);
K = subs(K, diff(y, t), dy);
K = subs(K, diff(phi, t), dphi);
pL_x = simplify(diff(L, x));
pL_y = simplify(diff(L, y));
pL_phi = simplify(diff(L, phi));
pL_dx = simplify(diff(L, dx));
pL_dy = simplify(diff(L, dy));
pL_dphi = simplify(diff(L, dphi));
EoM1 = diff(pL_dx, t) - pL_x == 0;
EoM2 = diff(pL_dy, t) - pL_y == 0;
EoM3 = diff(pL_dphi, t) - pL_phi == TAU;
EoM1 = subs(EoM1, dx, diff(x, t));
EoM1 = subs(EoM1, ddx, diff(x, t, t));
EoM1 = subs(EoM1, dy, diff(y, t));
EoM1 = subs(EoM1, ddy, diff(y, t, t));
EoM1 = subs(EoM1, dphi, diff(phi, t));
EoM1 = subs(EoM1, ddphi, diff(phi, t, t));
EoM2 = subs(EoM2, dx, diff(x, t));
EoM2 = subs(EoM2, ddx, diff(x, t, t));
EoM2 = subs(EoM2, dy, diff(y, t));
EoM2 = subs(EoM2, ddy, diff(y, t, t));
EoM2 = subs(EoM2, dphi, diff(phi, t));
EoM2 = subs(EoM2, ddphi, diff(phi, t, t));
EoM3 = subs(EoM3, dx, diff(x, t));
EoM3 = subs(EoM3, ddx, diff(x, t, t));
EoM3 = subs(EoM3, dy, diff(y, t));
EoM3 = subs(EoM3, ddy, diff(y, t, t));
EoM3 = subs(EoM3, dphi, diff(phi, t));
EoM3 = subs(EoM3, ddphi, diff(phi, t, t));
I0 = (1/12)*m0*4*(a^2*b^2);
EoMs = [EoM1, EoM2, EoM3].';
new_system('my_simple_sys')
matlabFunctionBlock('my_simple_sys/vdp', EoMs, 'vars', {'t', 'x', 'y', 'phi', 'TAU'})
Warning: Function 'x' not verified to be a valid MATLAB function.
Warning: Function 'y' not verified to be a valid MATLAB function.
Warning: Function 'phi' not verified to be a valid MATLAB function.
Warning: Function 'TAU' not verified to be a valid MATLAB function.