next up previous
Next: Car parking Up: Scilab demonstration pages Previous: Subplots

n-pendulum

This is an application of Scilab-Maple interface to an N link pendulum. Maple (euler.map,npend.map) is used to generate fortran code npend.f used to compute the state derivative of the N link pendulum. This function is passed as argument to the scilab ode solver.
Details (Maple, Fortran and Scilab code) may be found in <SCIDIR>/demos/npend directory.
  if getenv('WIN32','NO')=='OK' & getenv('COMPILER','NO')=='VC++' then
    cur_wd = getcwd();
    chdir(SCI+"/demos/npend/Maple");
    host("nmake /f Makefile.mak ");
    chdir(cur_wd);
    if ~c_link('npend') then link('c:/tmp/npend.dll','npend');end
  else
    host("cd $"+path+"; make ");
    if ~c_link('npend') then link('/tmp/npend.o','npend');end
  end
  n=np();
  r=1*ones(1,n);m=1*ones(1,n);j=1*ones(1,n);g=9.81;
  y0=0*ones(2*n,1);
  tt=0:0.05:10;
  yt=ode(y0,0,tt,'npend');
  chaina(yt);
  xselect();

m0_9.1.gif animation 62K


Scilab group