Solves a linear Differential Equation.
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 )
a n-by-1 matrix of doubles, the initial state
a 1-by-1 matrix of doubles, the initial time
a m-by-1 matrix of doubles, the times where to compute the solution
a n-by-n real matrix of doubles
a 1-by-1 matrix of doubles, the relative tolerance (default rtol=1.d-5)
a 1-by-1 matrix of doubles, the absolute tolerance (default atol=1.d-7)
a 1-by-1 matrix of strings, the name of the solver (default solname = "rk"). Solvers available are "adams" "stiff" "rk" "rkf" "fix".
a m-by-1 matrix of doubles, the solution of the differential equation
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
// 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" ); | ![]() | ![]() |
http://en.wikipedia.org/wiki/Matrix_exponential
"Systèmes dynamiques", Claude Gomez, 2007, http://www.scilab.org/team/claude.gomez/papers/sistdynpdf.pdf