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)

    When I saw it I was so glad I could not speak. My eyes seemed too little to see it all.... I was a long time without speaking to my friend. To see me always looking and never speaking he thought I had lost my mind. I could not understand where all this could come from.
    —For the State of Maine, U.S. public relief program (1935-1943)