Borrar filtros
Borrar filtros

Initial Conditions parameter for ode23

3 visualizaciones (últimos 30 días)
Steven Iverson
Steven Iverson el 11 de Feb. de 2011
Respondida: David Sanchez el 14 de En. de 2014
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.

Respuestas (2)

Mischa Kim
Mischa Kim el 14 de En. de 2014
The exact same way, just write down the matrix, e.g., A0 = [1 2 3; 4 5 6].

David Sanchez
David Sanchez el 14 de En. de 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.

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by