Initial Conditions parameter for ode23
조회 수: 4 (최근 30일)
이전 댓글 표시
In the documentation for ode23, it says the initial conditions must be stated as a vector. How would it be possible to make the initial conditions a matrix? I am doing this in order to avoid having a large sparse matrix and having to use a Kronecker product.
댓글 수: 0
답변 (2개)
Mischa Kim
2014년 1월 14일
The exact same way, just write down the matrix, e.g., A0 = [1 2 3; 4 5 6].
댓글 수: 0
David Sanchez
2014년 1월 14일
There is a very clear example in the documentation:
To simulate a system, create a function vdp1000 containing its equations
function dy = vdp1000(t,y)
dy = zeros(2,1); % a column vector
dy(1) = y(2);
dy(2) = 1000*(1 - y(1)^2)*y(2) - y(1);
For this problem, we will use the default relative and absolute tolerances (1e-3 and 1e-6, respectively) and solve on a time interval of [0 3000] with initial condition vector [2 0] at time 0.
[T,Y] = ode15s(@vdp1000,[0 3000],[2 0]); % ode15s and ode23 are used in the same way
The initial condition vector represents y(1) and y(2) initial values ( y(1)_0 = 2 ; y(2)_0 = 0 ), and that is why they have to be included in the same array.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!