[Scilab-users] How to get matrix output from ODE ?

Richard jrich at littleappletech.com
Mon Apr 22 14:48:32 CEST 2019


Hello - using scilab 6.0.2 on windows 7 pro;
I'm pretty much a newbie here, but somewhat familiar with differential 
equations.
However, I cannot find a way to get a matrix (NOT a VECTOR!) output from 
the scilab 'ode' function. No matter what, all it gives is a row vector.
Example code (nonlinear Rossler equations):

  function [ydot]=rdv(t,y)
      ydot(1) = -(y(2) + y(3))
      ydot(2) = y(1) + 0.2*y(2)
      ydot(3) = 0.2 + y(3)*(y(1) - 5.7)
endfunction
t=0:0.05:50;
t0=0;y0=[-1.0,0.0,0.0];
y=ode(y0,t0,t,list(rdv,a,b,c));
param3d(y(1),y(2),y(3))

... makes 'plot', an empty 3-d box. This makes sense, because scilab 
says the 'y' variable is a simple '1x3003' row vector.
No matter how I ask for the LHS output, (examples: [y], 
[y1,y2,y3,]...[y(1),y(2),y(3)...],) I get only errors or empty plot.
'Help' claims 'y' should be a vector "or matrix", but the "matrix" never 
shows up at all. Scilab 'help' has no examples of simple matrix systems 
of all 1st order DE's, and I cannot find any such examples online.

Some older references (including books) suggest indexing like '[y(1,:), 
y(2,:), y(3,:)]'. This just gives 'indexing error' in 6.0.2.

This is easily solved with fortran using the ancient Netlib 'RKF45' 
package. THEN I can plot the parametric solution by reading in to scilab.

  But I cannot quite understand how to get any useful solution from 
scilab. Maybe there is a way to 'partition' the simple row vector output 
into what SHOULD BE a 3 x 1001 matrix (or 1001 x 3, whatever).

What am I doing wrong? Thanks for any help here.

jrc




More information about the users mailing list