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)

    Resorts advertised for waitresses, specifying that they “must appear in short clothes or no engagement.” Below a Gospel Guide column headed, “Where our Local Divines Will Hang Out Tomorrow,” was an account of spirited gun play at the Bon Ton. In Jeff Winney’s California Concert Hall, patrons “bucked the tiger” under the watchful eye of Kitty Crawhurst, popular “lady” gambler.
    —Administration in the State of Colo, U.S. public relief program (1935-1943)