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:

    As a rule they will refuse even to sample a foreign dish, they regard such things as garlic and olive oil with disgust, life is unliveable to them unless they have tea and puddings.
    George Orwell (1903–1950)

    George Shears ... was hanged in a barn near the store. The rope was thrown over a beam, and he was asked to walk up a ladder to save the trouble of preparing a drop for him. “Gentlemen,” he said, “I am not used to this business. Shall I jump off or slide off?” He was told to jump.
    —For the State of Montana, U.S. public relief program (1935-1943)