I am working on a position controller for a marine vessel. I have a measurement signal containing the y-position of the vessel that consists of both low frequency (<.1 rad/s) and high frequency (>.6 rad/s) motions. I am currently using a state observer that separates that combined motion in two separate states (a LF and WF states). The gains are calculated using the discrete time Kalman filter algorithm.
At every timestep I receive a new incoming measurement and my state observer corrects the predicted state with the measurement.
I want to compare the performance of this approach with using a low pass filter on the measurement signal instead of using an Kalman filter. The theory seems to be that a Kalman filter has a much lower phase lag, but I am seeing some amplifications in the magnitude bode plot of my outgoing LF signal compared to the incoming measurements and the filter thus amplifies motions that are between the LF and the WF frequencies...
I need some advice on how to implement a nth-order low pass filter in such a discrete time system. Is there an algorithm to filter the incoming measurements at every time step, or do i need to take the entire time trace of the measurement and filter that signal? I am using Matlab.
Any tips are more than welcome, Scott