Index: mttroot/mtt/bin/trans/make_ode2odes ================================================================== --- mttroot/mtt/bin/trans/make_ode2odes +++ mttroot/mtt/bin/trans/make_ode2odes @@ -15,11 +15,11 @@ Nu=`grep "MTTNu " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'` Ny=`grep "MTTNy " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'` cat << EOF > $1_ode2odes.m -function $1_ode2odes +# Program $1_ode2odes EOF # Do the globals sympar2global_txt2m $1 >> $1_ode2odes.m @@ -26,20 +26,26 @@ # The rest of the program cat << EOF >> $1_ode2odes.m $1_simpar; # Read in simulation parameters $1_numpar; # Read in parameters -MTTx = $1_state; # Read in state + +iLast = round(LAST/DT); # Total number of steps -iLast = round(Last/DT); # Total number of steps - +#Initialise t = 0.0; +MTTx = $1_state; # Read in initial state +MTTu = $1_input(MTTx,t); # Evaluate initial input +MTTy = $1_odeo(MTTx,MTTu,t); # Evaluate initial output +mtt_write(t,MTTx,MTTy,$Nx,$Ny); # And write them + +#Integration loop for it = 1:iLast MTTu = $1_input(MTTx,t); MTTdx = $1_ode(MTTx,MTTu,t); for j = 1:$Nx - MTTx[j] = MTTx[j] + MTTdx[j]*DT; + MTTx(j) = MTTx(j) + MTTdx(j)*DT; end; MTTy = $1_odeo(MTTx,MTTu,t); t = t + DT; mtt_write(t,MTTx,MTTy,$Nx,$Ny); end;