Simulink : dynamic system simulation for MATLAB: writing S-functions. (The Math works, 2000)