Alpha Beta Filter - Sample Program

Sample Program

Alpha Beta filter can be implemented in C as follows:

#include #include main { float dt = 0.5; float xk_1 = 0, vk_1 = 0, a = 0.85, b = 0.005; float xk, vk, rk; float xm; while( 1 ) { xm = rand % 100;// input signal xk = xk_1 + ( vk_1 * dt ); vk = vk_1; rk = xm - xk; xk += a * rk; vk += ( b * rk ) / dt; xk_1 = xk; vk_1 = vk; printf( "%f \t %f\n", xm, xk_1 ); sleep( 1 ); } }

Read more about this topic:  Alpha Beta Filter

Famous quotes containing the words sample and/or program:

    The present war having so long cut off all communication with Great-Britain, we are not able to make a fair estimate of the state of science in that country. The spirit in which she wages war is the only sample before our eyes, and that does not seem the legitimate offspring either of science or of civilization.
    Thomas Jefferson (1743–1826)

    Lead bullets flattened by human teeth have been found on the camp site. Soldiers who had been caught stealing food from nearby farms customarily chewed on a bullet as the lash was laid on their bare backs.
    —For the State of New Jersey, U.S. public relief program (1935-1943)