<< scidemo_cmplxfacets Demonstration Toolbox scidemo_matrixeigshow >>

Demonstration Toolbox >> Demonstration Toolbox > scidemo_edolinear

scidemo_edolinear

Solves a linear Differential Equation.

Calling Sequence

y = scidemo_edolinear ( y0 , t0 , t , A )
y = scidemo_edolinear ( y0 , t0 , t , A , rtol )
y = scidemo_edolinear ( y0 , t0 , t , A , rtol , atol )
y = scidemo_edolinear ( y0 , t0 , t , A , rtol , atol , solname )

Parameters

y0 :

a n-by-1 matrix of doubles, the initial state

t0 :

a 1-by-1 matrix of doubles, the initial time

t :

a m-by-1 matrix of doubles, the times where to compute the solution

A :

a n-by-n real matrix of doubles

rtol :

a 1-by-1 matrix of doubles, the relative tolerance (default rtol=1.d-5)

atol :

a 1-by-1 matrix of doubles, the absolute tolerance (default atol=1.d-7)

solname :

a 1-by-1 matrix of strings, the name of the solver (default solname = "rk"). Solvers available are "adams" "stiff" "rk" "rkf" "fix".

y :

a m-by-1 matrix of doubles, the solution of the differential equation

Description

Computes the solution of a linear Differential Equation with the ode function.

The current function is a demonstration of the following functions.

We consider the following first order system of linear differential equations:

with the initial state:

The solution of this equation is

Examples

// To see the source code of this function:
edit scidemo_edolinear

// Compute and print the approximate solution.
scf();
// The number of time samples.
m = 100;
// The initial state.
y0 = [1;10];
// The linear operator.
A = [  1 1;  0 1.1];
// Initial and final times.
t0 = 0;
tf = 5;
t = linspace(t0,tf,100);
// Compute the solution
y = scidemo_edolinear ( y0 , t0 , t , A );
subplot(1,2,1)
// Plot y(1)
plot(t,y(1,:),"bo")
xtitle("","t (s)","y(1)")
// Plot y(2)
subplot(1,2,2)
plot(t,y(2,:),"bo")
xtitle("","t (s)","y(2)")

// Update the tolerances
y = scidemo_edolinear ( y0 , t0 , t , A , 1.e-10 , 1.e-10 );

// Change solver
y = scidemo_edolinear ( y0 , t0 , t , A , 1.e-5 , 1.e-7 , "fix" );

Authors

Bibliography

http://en.wikipedia.org/wiki/Matrix_exponential

"Systèmes dynamiques", Claude Gomez, 2007, http://www.scilab.org/team/claude.gomez/papers/sistdynpdf.pdf

<< scidemo_cmplxfacets Demonstration Toolbox scidemo_matrixeigshow >>