source: project/release/3/nemo/trunk/examples/carelli05-driver.m @ 13052

Last change on this file since 13052 was 13052, checked in by Ivan Raikov, 12 years ago

Save.

File size: 759 bytes
Line 
1#!/usr/bin/env octave
2
3function ys = euler(f,t,y,h)
4  t0=t(1); tn=t(2);
5  tx=t0; ys=zeros(ceil((tn-t0)/h),length(y));
6  ys(1,:)=y; i=1;
7  while (tx<tn)
8    i = i+1; tx=tx+h;
9    ys(i,:) = ys(i-1,:)' + (h * feval(f,tx,ys(i-1,:)));
10  endwhile
11endfunction
12
13## Carelli 05 model driver for Octave
14
15carelli05_defs = "carelli05.m";
16
17autoload ("Carelli05", carelli05_defs );
18autoload ("Carelli05_init", carelli05_defs );
19
20y0 = Carelli05_init(-68)
21
22#t = linspace (0, 100, 1000);
23#lsode_options("initial step size",1e-3);
24#lsode_options("minimum step size",1e-5);
25#lsode_options("absolute tolerance",1e-2);
26#lsode_options("relative tolerance",1e-4);
27#y = lsode ("Carelli05", y0, t);
28
29t = [0,100];
30y = euler (@Carelli05, t, y0, 1e-3);
31
32
33save "-ascii" "carelli05.dat" y;
Note: See TracBrowser for help on using the repository browser.