Initial Conditions parameter for ode23
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Mischa Kim
am 14 Jan. 2014
The exact same way, just write down the matrix, e.g., A0 = [1 2 3; 4 5 6].
0 Kommentare
David Sanchez
am 14 Jan. 2014
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 Kommentare
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!