File: npend.dem

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (65 lines) | stat: -rw-r--r-- 1,845 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
mode(-1);
// Copyright INRIA

path="SCI/demos/npend";

getf(path+'/macros.sci');
getf(path+'/dessin.sci');
xbasc();
flag1=x_choose(['Read a precomputed trajectory';
        'Simulation with ode (needs f77 and link. may fail. see help link)'],...
         'Simulation or Visualisation ? (click below)');

select flag1,
case 2 then 
  mode(1)
  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
    if ~c_link('ener')  then link('c:/tmp/ener.dll','ener');end
    if ~c_link('np')  then link('c:/tmp/np.dll','np');end
  else 
    host("cd $"+path+"; make ");
    if ~c_link('npend') then link('/tmp/npend.o','npend');end
    if ~c_link('ener')  then link('/tmp/ener.o','ener');end
    if ~c_link('np')  then link('/tmp/np.o','np');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');
  xselect();
  xbasc();
  chaina(yt);
  flag=2 ; 
  y=[]; for i=1:n;y=[y;'theta'+string(i)];end
  yd=[]; for i=1:n;yd=[yd;'thetad'+string(i)];end
  ystr=[y;yd];
  while flag==2, 
    [n1,n2]=size(yt);
    flag=x_choose(['Stop';'Go on'],'Choose');
    if flag==2 then
      y0=evstr(x_mdialog(['Initial point '],ystr,...
	  string(yt(:,n2))));
      yt=ode(y0,0,tt,'npend');
      met=x_choose(['With last point trajectory';'Without'],...
	  'Graphic Option');
      xbasc();
      if met==1; chainb(yt);else;chaina(yt);end
    end
  end
  mode(-1)
case 1 then // A precomputed value for 
  mode(1)
  //x0=[0;%pi/2+0.1;0;5.0;0.0;4.0;0;0];
  n=10;
  r=1*ones(1,n);m=1*ones(1,n);j=1*ones(1,n);g=9.81;
  y0=0*ones(2*n,1);
  yt=read(path+'/yt.wrt',20,201);
  chaina(yt);
  mode(-1)
end