Index: mttroot/mtt/bin/trans/ode2odes_m ================================================================== --- mttroot/mtt/bin/trans/ode2odes_m +++ mttroot/mtt/bin/trans/ode2odes_m @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.11 1997/08/29 07:56:54 peterg +## Minor updates +## # Revision 1.10 1997/01/07 09:16:03 peterg # Added step_factor parameter - gives that number of integration steps # per sample. # ## Revision 1.9 1997/01/06 21:36:44 peterg @@ -48,43 +51,52 @@ ## Initial revision ## ############################################################### echo Creating $1_odes.m +echo Creating $1_odeso.m + rm -f ode2odes_m.log - -if [ "$2" = "" ]; -then - PARAMS='T=[0:0.1:10]; x0=zeros(nx,1);' - echo Using default parameter $PARAMS - echo $PARAMS>$1_args.m -else - PARAMS=$2; -fi +rm -f mtt_error.txt + +#if [ "$2" = "" ]; +#then +# PARAMS='T=[0:0.1:10]; x0=zeros(nx,1);' +# echo Using default parameter $PARAMS +# echo $PARAMS>$1_args.m +#else +# PARAMS=$2; +#fi # PARAMS="$PARAMS ;" $MATRIX << EOF > ode2odes_m.log 2>mtt_error.txt - step_factor = 1; %Set up default step factor %Read in parameters - $1_numpar; + $1_numpar; + + %Read in state + x = $1_state + + %Read in simulation parameters + $1_simpar + T = [0:DT:LAST] [nx,ny,nu,nz,nyz] = $1_def; t=0; %Just in case it appears in the parameter list. - $PARAMS %Defaults if exist('T')==0 - T=[0:0.1:10] + T=[0:1:100] end; - if exist('x0')==0 - x0 = zeros(nx,1); - end; + % if exist('x0')==0 + % % x0 = zeros(nx,1); + % x0 = x; + % end; [n,m]=size(T); if m>n T=T'; end; @@ -91,18 +103,18 @@ if nx>0 % x = lsode('$1_ode', x0, T); %Euler integration - x = x0; +% x = x0; X=[]; - dt = (T(2)-T(1))/step_factor; + dt = (T(2)-T(1))/STEPFACTOR; for t=T' X = [X x]; ts = t; - for i=1:step_factor + for i=1:STEPFACTOR dx = $1_ode(x,ts); ts = ts + dt; x = x + dx*dt; end; end;