How to get eqns datatype from equations in function?
Mostrar comentarios más antiguos
I can use functions like A = equationsToMatrix(eqns) with direct eqns input parameters, e.g.
A = equationsToMatrix([x+y,4*x-2*y]);
but when storing equation systems in functions like
function dZ = ODE(~,z)
x = z(1);
y = z(2);
dZ = [x+y;...
4*x-2*y];
end
I need a reference to the equations in the function so that i could use it like
A = equationsToMatrix([oderef(1),oderef(2)]); %does not work!
oderef(1) and oderef(2) must stand for the 2 equations defined in my function ODE and must be of datatype eqns so that equationsToMatrix can accept these as a parameter. How do I do that? Thanks.
Respuestas (1)
Walter Roberson
el 24 de Sept. de 2017
Editada: Walter Roberson
el 24 de Sept. de 2017
There is no "eqns" datatype.
It looks to me as if you should be using
odehandle = matlabFunction(A(:), 'vars', {t, [x, y]});
3 comentarios
Walter Roberson
el 24 de Sept. de 2017
Is there a particular form that your original ODE must be in?
Do any of the ODE involve second derivative? Are any of them second order? Do any of them involve mass matrices? With your reference to eigenvectors, does that imply you are working with Matrix Differential Equations?
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!