Exercises — Sensor fusion — complementary filter (simple), Kalman filter (optimal)
3.5.20 · D4· Physics › Guidance, Navigation & Control (GNC) › Sensor fusion — complementary filter (simple), Kalman filter
Quick symbol reminder taaki tum kabhi guess na karo:
Level 1 — Recognition
L1·1 — Weight ko naam do
Complementary filter update hai aur ke saath, calculate karo. Yeh value kaun se sensor par zyada trust karti hai?
Recall Solution
. WHAT this means: gyro prediction ko multiply karta hai, isliye hum is instant mein gyro par heavily trust karte hain. Remaining gently accel ki taraf khichta hai — long-term drift mitane ke liye kaafi, fast accel noise reject karne ke liye itna chota.
L1·2 — Kalman gain padho
Ek Kalman step mein prior variance hai aur measurement noise hai. Gain compute karo aur words mein batao ki us size ka gain measurement ke saath kya karta hai.
Recall Solution
. WHAT it does: update hai , isliye hum apne prior se new reading ki taraf 75% raasta move karte hain. WHY itna zyada? Kyunki prior () sensor () se zyada uncertain hai, isliye sensor ko louder vote milna chahiye.
Level 2 — Application
L2·1 — Ek complementary step
Given , , previous estimate , gyro rate , accel angle . nikalo.
Recall Solution
Step A — WHAT: build karo. . Step B — WHY pehle predict karein: angle kahan gaya yeh guess karne ke liye rate integrate karo. Gyro prediction . Step C — Fuse: . WHAT it looks like: humne mostly gyro ke downward swing ko follow kiya, phir accel ne hume thoda aur neeche kheecha (kyunki ).
L2·2 — Ek full Kalman cycle
Start , , with , , aur reading . predict → gain → update → variance run karo.
Recall Solution
Predict. (no motion model but the state); . WHY : uncertainty hamesha measurements ke beech badhti hai. Gain. . Update. . Variance. . WHAT it looks like: estimate reading ki taraf two-thirds of the way tak phunga, aur uski variance se tak drop ho gayi — dono prior aur sensor se neeche. Fusion hamesha sharpen karta hai.
Level 3 — Analysis
L3·0 — ke limiting cases: trust kahan jaata hai?
use karke, describe karo ki complementary filter ke saath kya hota hai do extremes mein: ( fixed ke saath) aur .
Recall Solution
Case (ya ): . WHAT it looks like: — pure gyro integration, accel term . WHY: ticks arbitrarily fast aane se, corrections ke beech sirf thodi si drift build hoti hai, isliye smooth gyro rule karta hai aur noisy accel ignore hota hai. Yeh high-frequency / short-term regime hai. Case : . WHAT it looks like: — estimate sirf accel copy karta hai; gyro prediction discard ho jaati hai. WHY: ek lambe gap mein gyro ki drift bahut badi ho gayi hai, isliye hum stale prediction throw away karte hain aur drift-free accel par re-anchor karte hain. Yeh low-frequency / long-term regime hai. Knob tumhe in poles ke beech slide karta hai: bada ( ke relative) → → gyro-dominated; chota → → accel-dominated. Crossover exactly wahan hai jahan , deta hai .
L3·1 — Steady-state Kalman gain
Filter ko forever run karne do jab tak change karna band na ho jaaye: settled value ko kaho. Yeh satisfy karta hai , lo. aur steady gain nikalo.
Recall Solution
WHAT we do: steady state par . ke saath mein gain substitute karo. Step 1 — fixed-point equation assemble karo. use karke, updated variance hai (yeh "" form hai). Steady state par aur , isliye Step 2 — denominator clear karo. Dono sides ko se multiply karo. WHY: fraction ko ek polynomial mein baadalna jo hum solve kar sakein. Step 3 — har side expand karo. Left: . Right: . Step 4 — shared term cancel karo dono sides se (yeh identically appear karta hai), ek clean quadratic bach jaati hai: Step 5 — quadratic solve karo. ke saath: . Quadratic formula do roots deta hai Step 6 — physically valid root choose karo. WHY hum root discard karte hain: ek variance hai, aur variance ek squared spread hai — yeh kabhi negative nahi ho sakta. root deta hai , jo variance ke liye impossible hai, isliye hum use reject karte hain. root hai Phir , aur . WHAT it means: ek baar settle hone ke baad, Kalman gain ek constant hai — matlab ek settled Kalman filter hai hi ek complementary filter jisme .
L3·2 — Precisions add karte hain
Same angle ke do independent estimates: ek variance ke saath, ek (measurement) variance ke saath. Numerically dikhao ki fused variance satisfy karta hai, aur naive averaging se compare karo.
Recall Solution
Kalman way. , isliye . Precision rule check karo. , aur . ✓ Naive average ( each). Do independent estimates ka average karne par, average ki variance hai — optimal se worse. WHY: equal weighting ignore karta hai ki pehla source zyada precise hai. Optimal weight sharper source ki taraf lean karta hai, variance aur neeche squeeze karta hai. Information (= inverse variance) simply add hoti hai.
Level 4 — Synthesis
L4·1 — Complementary ko Kalman steady state se match karo
Ek engineer ne par ke saath ek complementary filter banaya. Woh chahti hai ki Kalman filter steady state par identically behave kare. Agar uske sensor ka hai, toh kaunsa process noise steady Kalman gain deta hai?
Recall Solution
WHAT the match requires: . L3·1 se settled relations yaad karo: aur . Gain se: jahan , isliye . Aur . Phir . WHAT it means: tiny (aur ) wala Kalman filter usi blend par lock ho jaata hai jo uska complementary filter use karta hai. Dono filters steady state par same machine hain — Kalman bas noisy start-up transient bhi handle karta hai.
L4·2 — ka convergence curve
, , se start karke, , , use karke list karo. Confirm karo ki yeh L3·1 ke ki taraf ja raha hai.
Recall Solution
Step 1. , , . Step 2. , , . Step 3. , , . WHAT it looks like (neeche figure dekho): plunge karta hai , ki taraf settle hota hua. Gain uske saath neeche ride karta hai. Woh falling curve exactly wahi hai jo Kalman ko fixed se beat karta hai: shuruaat mein yeh measurements ko hard grab karta hai (high ), phir relax ho jaata hai jaise confidence build hoti hai.

Figure — kya observe karna hai (alt-text): Ek blueprint-style plot jisme horizontal axis par step number hai aur vertical axis par value hai. Circles wala cyan curve estimate variance hai: yeh upar se start hota hai aur steeply drop karta hai — — dashed white line ki taraf flatten hota hua. Squares wala amber curve Kalman gain hai: yeh upar se start hota hai (near , "shuruaat mein measurements hard grab karta hai") aur ki taraf settle hota hai ("jaise confident hota hai relax ho jaata hai"). Jo tumhe samajhna chahiye: dono uncertainty aur measurement-par-trust saath mein sikhte hain aur L3·1 mein compute ki gayi steady-state value par level off karte hain — yeh converged, frozen gain precisely complementary filter ka fixed hai.
Level 5 — Mastery
L5·1 — Optimal gain scratch se derive karo
Estimate ek weighted correction hai , prior error variance aur independent measurement noise variance ke saath. Prove karo ki posterior variance minimise karne wala hai , aur tab .
Recall Solution
Step A — WHAT: error likho. True value ho. Prior error ki variance hai; measurement error ki variance hai, se independent. Tab Step B — WHY variances add karte hain: aur independent hain, isliye unki variances squared coefficients ke saath add hoti hain: Step C — Minimise karo. WHY derivative? mein ki ek smooth upward parabola hai; uske lowest point par slope zero hota hai. Step D — Back-substitute karo. . Kyunki hai, se multiply karo: , isliye WHAT it means: "" law directly follow karta hai, aur gain kuch nahi bas "har source par uski precision ke proportion mein trust karo" hai.
L5·2 — Complementary filter ka unity DC gain
Dikhao ki aur sabhi ke liye sum karke dete hain, aur har ek ko (DC, constant input) par aur (bahut fast input) par evaluate karo. Interpret karo.
Recall Solution
Sum. har ke liye. WHY yeh matter karta hai: jo bhi frequency ho, dono paths ke weights ka total hamesha hota hai, isliye koi scaling error creep in nahi ho sakti. DC, : , . Ek constant angle poori tarah accel path se pass hota hai — jo drift-free hai, exactly wahi jo hum long-term truth ke liye chahte hain. Fast, : , . Quick wiggles poori tarah gyro path se pass hoti hain — short-term smooth aur noise-free. WHAT it means: har sensor woh band rule karta hai jahan woh trustworthy hai, aur kyunki transfer functions ka sum hai, ek steady input apna exact size rakhta hai (unity DC gain) — koi steady-state bias nahi. Yeh L3·0 ke limits ka frequency-domain mirror hai: DC ↔ (accel), high frequency ↔ (gyro).
Recall Self-test cloze — cover karke recall karo
Complementary blend weight hai ::: Kalman gain hai ::: Predict variance ko badhata hai add karke ::: process noise , deta hai Bada filter ko measurement par trust karna ::: kam karta hai (chota ) Do Gaussians fuse karne par unke ::: precisions (inverse variances) add hote hain Jab complementary filter trust karta hai ::: gyro ko poori tarah () Jab complementary filter trust karta hai ::: accel ko poori tarah () Angles blend karne se pehle tumhe ::: difference ko mein wrap karna hoga (shortest arc) Steady-state Kalman filter equivalent hai ek ::: complementary filter ke jisme fixed gain ho
See also: Low-pass and High-pass filters, Gaussian distribution, Bayesian estimation, State-space models, Attitude estimation (AHRS), Extended Kalman Filter, Inertial Navigation Systems.