Changeset 25510 in project
 Timestamp:
 11/16/11 15:08:39 (10 years ago)
 Location:
 release/4/signaldiagram/trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

release/4/signaldiagram/trunk/examples/Izhikevich03_run.m
r23951 r25510 6 6 7 7 autoload ("RS", Izhikevich03_defs ); 8 autoload ("RS_event", Izhikevich03_defs ); 8 9 autoload ("RS_initial", Izhikevich03_defs ); 9 10 autoload ("IB", Izhikevich03_defs ); … … 19 20 20 21 t0 = 0.0; 21 t1 = 150.0;22 t1 = 500.0; 22 23 23 RS_state = RS_initial; 24 RS_ys = [[RS_state.t,RS_state.V]]; 24 global RS_state 25 RS_state = RS_initial 26 RS_ys = [[RS_state.t,RS_state.U,RS_state.V,RS_state.spike]]; 27 28 tic; 25 29 while (RS_state.t < t1) 26 y = RS(RS_state); 27 y.t 28 RS_state.t = y.t; 29 RS_state.U = y.U; 30 RS_state.V = y.V; 31 RS_state.spike = y.spike; 32 RS_state.tspike = y.tspike; 33 RS_ys = [RS_ys; [y.t,y.V]]; 30 y = RS(RS_state); 31 32 if (y.spike) 33 RS_state.h = 1e3; 34 y = RS(RS_state); 35 else 36 if (RS_state.h < 0.25) 37 RS_state.h = RS_state.h+1e1; 38 endif 39 endif 40 41 RS_state.t = y.t; 42 RS_state.U = y.U; 43 RS_state.V = y.V; 44 RS_state.spike = y.spike; 45 RS_state.tspike = y.tspike; 46 RS_ys = [RS_ys; [y.t,y.U,y.V,RS_state.spike]]; 34 47 endwhile 48 toc; 35 49 36 50 # IB_state = IB_initial; 
release/4/signaldiagram/trunk/signaldiagram.scm
r25492 r25510 1230 1230 "function " (name/Octave (codegenrv fcodegen)) " = " (name/Octave name) " (input)" nl 1231 1231 (list "global " (intersperse globals " ") ";" nl) 1232 (map (lambda (x) (list (name/Octave x) " = " (value>Octave (V:Sel x (V:Var 'input))) "; " nl)) input) nl 1232 (map (lambda (x) (list (name/Octave x) " = " (value>Octave (V:Sel x (V:Var 'input))) "; " nl)) input) 1233 nl 1233 1234 (map expr>Octave (append relationsexpr (codegenexpr fcodegen))) nl 1234 "end " nl))1235 "endfunction" nl)) 1235 1236 1236 1237 (if (pair? events) … … 1240 1241 "function " (name/Octave "retval") " = " (name/Octave (stringappend (>string name) "_event")) " (input)" nl 1241 1242 "retval = [" (intersperse eventvector ",") "];" nl 1242 "end " nl))))1243 "endfunction" nl)))) 1243 1244 1244 1245 1245 1246 (if initial 1246 (printfragments 1247 (list (name/Octave name) "_initial = " 1248 (value>Octave 1249 (V:Rec (map (lambda (x) (let ((n (car x)) (v (cadr x))) 1250 (let ((v (cond ((and (or (number? v) (symbol? v))) v) 1251 ((boolean? v) (if v 'true 'false)) 1252 (else v)))) 1253 (list n (V:C v))))) 1254 initial))) nl))) 1247 (printfragments 1248 (list (name/Octave name) "_initial = " 1249 (value>Octave 1250 (V:Rec (map (lambda (x) (let ((n (car x)) (v (cadr x))) 1251 (let ((v (cond ((and (or (number? v) (symbol? v))) v) 1252 ((boolean? v) (if v 'true 'false)) 1253 (else v)))) 1254 (list n (V:C v))))) 1255 initial))) nl)) 1256 ) 1255 1257 1256 1258 … … 1259 1261 (define (codegen/scheme name f #!key (initial #f) (pre #t) (solver 'rk4b)) 1260 1262 1261 (if (and solver (not (member solver '(rkfe rk3 rk4a rk4b rkhe rkbs rkf45 ))))1263 (if (and solver (not (member solver '(rkfe rk3 rk4a rk4b rkhe rkbs rkf45 ode15s)))) 1262 1264 (error 'codegen/scheme "unknown solver" solver)) 1263 1265
Note: See TracChangeset
for help on using the changeset viewer.