ODE for 2 variables
이전 댓글 표시
Hello all,
Does matlab support DE of this type: d(xy)/dt (ie. y dx/dt + x dy/dt)? If so how to werite these type of equations? I am a new comer to matlab and any help would be great!
Thanks.
댓글 수: 2
Torsten
2019년 8월 6일
You will need two equations to determine x and y. What is your second equation ?
Nivedhitha S
2019년 8월 6일
채택된 답변
추가 답변 (1개)
Steven Lord
2019년 8월 6일
1 개 추천
Write your equations in the form M*DV = RHS where:
, 
and M is the mass matrix. Since your second equation expands to:
the second row of your mass matrix will be [y, x, 0, 0]. Multiply that vector times DV and you'll see that you've recreated the left side of the second differential equation. Generate the remaining rows of the mass matrix similarly.
Create an options structure that specifies the mass matrix using odeset and the 'Mass' name-value pair. The value for that pair will be a function handle that accepts t (time) and the vector V and returns the mass matrix M.
Then write the function that evaluates RHS as a function of t and V. Call the ODE solver specifying that function and the options structure (so the solver knows how to create the mass matrix.
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!