Creating a digital filter, from Laplace to $\mathcal Z$-transform (zero order hold) to code?
The example I looked at used a tustin or bilinear conversion not a zero order hold(the default for matlabs "c2d" command). So this is more an answer to what i wanted to do rather than the question that i asked above.

I solved the following (converting the s domain function into code) by taking the s domain function.
$$\frac{as+b}{cs^2+ds}$$

and putting this into matlab (matlab command "g=tf([a b],[c d 0])"). Then performed the bilenear conversion with the matlab command "c2d(g,Ts,'tustin')" where g was my transfer funtion and Ts my sampling rate. This produced the output

$$\frac{ez^2+fz+g}{iz^2+jz+k}$$

The a and b coeficients can then be taken from this equation such that(if $i!=1$ the equation needs to be multiplied through by the inverse of "i"):
$b0=e$ $b1=f$  $b2=g$ 
 $a0=i$  $a1=j$ $a2=k$

this can then be converted to code by setting the initial states for simplicity let $$z0=z1=z2=0$$

then set up a loop that repeats the following algorithm

$$output=z0*b0+z1*b1+z2*b2$$
$$z2=z1$$
$$z1=z0$$
$$z0=input-a1*z1-a2*z2$$

For anyone else that got lost like me, this is known as an IIR filter and googling IIR filter design helped sooo much.