function dxdtau = deriv01(tau,x) % function deriv01(tau,x) supplies the ODE definitions % needed by m-file ex01.m % ex01 calls the standard MATLAB function ode45() % and ode45() calls deriv01() % x is the dependent variable, fractional conversion % in deriv01.m, x is a 1x1 array, that is, a scalar % tau is the independent variable, space time % dxdtau holds the current value of the derivative % dxdtau is a 1x1 array with only one element, that is, a scalar % dxdtau = dx/dtau % declare "global" variable shared with file "ex01.m" % its value is assigned in file "ex01.m" global k % x is a scalar so .* not needed below % calculate derivative % dxdtau = dx/dtau dxdtau = k * (1 - x); % dxdtau value is returned by this function to the calling routine % end of function