Change integral
to imIntegral 0
displacement = feedback (-) (velocity >>> imIntegral 0) (gain $ k / m) 0
velocity = feedback (-) (imIntegral 0) (gain $ c / m) 0
From spring.hs:
Using Simulink:
Something funny is happening in the integral function, changing to imIntegral 0
gives the same curve as in matlab.
My guess is that Integral
is delayed by one sample, since it doesn't have a starting value, changing the behaviour of the loop.