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)

    Once, when lying in bed with no paper at hand, he began to sketch the idea for a new machine on the back of his wife’s nightgown. He asked her if she knew the figure he was drawing. “Yes,” she answered, “the figure of a fool.”
    —For the State of New Jersey, U.S. public relief program (1935-1943)