code for implementation discrete controller at arduino uno

0
down vote
favorite

I want to realize this DIFFERENCE EQUATION/TRANSFER FUNCTION at arduino UN0 U(n)=U(n-1)+330e(n)-634.2e(n-1)+304.6*e(n-2) i will use PWM AND FILTER in place of DAC. SAMPLING PERIOD=0.002 Second(as the period of PWM) the input=unit step=1 Volt Could you help me to write the code at arduino uno ? i have not experience at arduino.Please help me

What does pwm have to do with that function?

How large are the values you expect to be handling? Integer or floating point? Unless there is some complication, the function definition should be trivial.

this equation is the inverse z transform .i will implement a digital controller with arduino.input is a (error analog signal) and output analog signal.the reference=1 v and we must use float number.