I would normally expect this to work for other systems of differential equations:
syms k1 k2 k3 k4 k5 k6 k7 k8 u x(t) y(t) Y
Dx = diff(x);
D2x = diff(Dx);
Dy = diff(y);
D2y = diff(Dy);
Eqn1 = k1*Dx + k2*Dy + k3*x + k4*y == u;
Eqn2 = k5*D2x + k6*D2y + k7*Dy + k8*y == 0;
[VF,Subs] = odeToVectorField(Eqn1, Eqn2)
odeFcn = matlabFunction(VF, 'Vars',{t, Y, u, [k1, k2, k3, k4, k5, k6, k7, k8]})
However, that code throws this error:
Error using mupadengine/feval (line 187)
Number of indeterminates exceeds the number of ODEs.
I must leave it to you to resolve that problem.
Best Answer