How to get eqns datatype from equations in function?
이전 댓글 표시
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.
답변 (1개)
Walter Roberson
2017년 9월 24일
편집: Walter Roberson
2017년 9월 24일
There is no "eqns" datatype.
It looks to me as if you should be using
odehandle = matlabFunction(A(:), 'vars', {t, [x, y]});
댓글 수: 3
Walter Roberson
2017년 9월 24일
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?
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!