3.5.24 · D4 · HinglishGuidance, Navigation & Control (GNC)

ExercisesExtended Kalman Filter (EKF) — linearization, Jacobians

3,138 words14 min read↑ Read in English

3.5.24 · D4 · Physics › Guidance, Navigation & Control (GNC) › Extended Kalman Filter (EKF) — linearization, Jacobians


Notation refresher (neeche use hone wale har symbol ki ek baar definition)

Koi bhi problem shuru karne se pehle, yeh rahe woh saare letters jo tumhe milenge, plain words mein:

Ise side pane mein khula rakho; solutions mein har symbol ko naam se bulaya gaya hai.


Level 1 — Recognition

L1.1 — Jacobian ki shape padho

Ek state mein numbers hain; ek sensor ke zariye numbers return karta hai. ki dimensions kya hain? Aur kaun sa entry jawaab deta hai "jab 1st state change hota hai toh 2nd sensor output kaise change hota hai"?

Recall Solution

kya hai: ek table jismein har output ke liye ek row aur har input ke liye ek column hota hai. Rows = outputs (), columns = inputs (). Maanga hua entry: "2nd output, 1st input" = row 2, column 1 = . KYU: Jacobian ka kaam exactly yahi hai ki har "output-per-input" slope store kare. Uski shape padhna = (sensor channels ki sankhya) × (state variables ki sankhya) padhna hai.

L1.2 — Mean kahan jaata hai?

EKF predict step mein, kya best estimate nonlinear se push hota hai ya matrix se?

Recall Solution

True nonlinear se: . KYU: kal ki state ka single best guess bas aaj ke best guess pe real motion law lagane se milta hai. Jacobian sirf spread (covariance) ko move karne ke liye use hota hai: . Inhe confuse karna classic error hai — mean curve se jaata hai, uncertainty uski tangent se.


Level 2 — Application

L2.1 — Naye point par Range Jacobian

Origin par Radar, target state , range . compute karo aur par evaluate karo.

Figure — Extended Kalman Filter (EKF) — linearization, Jacobians
Figure s01 — teal line origin par radar se par target tak line-of-sight hai. Plum arrow ek sideways () nudge dikhata hai jo length ko barely change karta hai (slope ); orange arrow ek outward () nudge dikhata hai jo line ko one-for-one lamba karta hai (slope ).

Recall Solution

Step 1 — square root differentiate karo. Chain rule kyun? ek curve hai; hume uska slope har direction mein chahiye. Step 2 — plug in karo: . KAISA DIKHTA HAI (figure s01 dekho): target seedha -axis ke upar baitha hai. Ise sideways slide karo ( mein, plum arrow) toh origin se distance barely change hota hai — range curve us direction mein flat hai, isliye slope hai. Ise ke saath outward slide karo (orange arrow) toh range one-for-one change hoti hai, isliye slope hai. Yeh exactly line-of-sight angle ke aur hain ( yahan).

L2.2 — Constant-velocity

State , dynamics , ke saath. numerically likho.

Recall Solution

Step 1 — partials. , ; , . KYU yeh constant hai: yahan already ek straight-line (linear) map hai, isliye uska slope depend nahi karta tum kahan ho — tangent function ke barabar hi hai. EKF plain Kalman Filter (linear) mein collapse ho jaata hai.


Level 3 — Analysis

L3.1 — Full range/bearing Jacobian, aur uska determinant

ke liye, symbolically assemble karo, phir par compute karo.

Recall Solution

Step 1 — range row (L2.1 se): . Step 2 — bearing row. kyun? Bearing ek angle hai; coordinates ke saath uski change rate chahiye. Step 3 — stack karo: Step 4 — par, : Interpretation: general determinant hai Yeh ke barabar hai — se tak ka mapping area ko se stretch karta hai, isliye linearization har jagah well-conditioned hai sivaaye origin ke, jahan yeh blow up karta hai.

L3.2 — Origin par bearing Jacobian kyun kaam karna band kar deta hai

Upar wale ka use karke, describe karo jab toh kya hota hai, aur physically kyun.

Recall Solution

Jaise : range row entries bounded rehti hain (woh angle ke hain), lekin bearing row entries blow up ho jaati hain ki tarah. Aur . PHYSICALLY KYU: bilkul sensor ke upar, ek infinitesimal sideways move bearing ko ek huge angle se swing kar deta hai — ek point par direction undefined hai. Tangent-line approximation (Taylor Series & Linearization) locally smooth function require karta hai; yahan singular hai, isliye EKF origin par invalid hai. Yeh ek degenerate case hai jisse tum zaroor guard karo.


Level 4 — Synthesis

L4.1 — Pendulum: linearize karo aur stiffness padho

Continuous pendulum , state , . lo. aur par compute karo, aur interpret karo.

Figure — Extended Kalman Filter (EKF) — linearization, Jacobians
Figure s02 — teal curve restoring acceleration hai. par orange dashed tangent steep hai (slope = full stiffness); par plum dashed tangent flat hai (slope = no stiffness). Tangent ka slope IS bottom-left Jacobian entry hai.

Recall Solution

Step 1 — general Jacobian. kyun? . Step 2 — par: , toh Bottom-left restoring stiffness hai. Full strength ⇒ yeh ordinary small-angle oscillator hai. Step 3 — par: , toh Stiffness gaayab ho gayi. Horizontal pendulum: gravity us instant par koi restoring twist nahi deti. KAISA DIKHTA HAI (figure s02 dekho): restoring term ek curve hai; uska slope (stiffness entry) par steepest hai (orange tangent) aur par flat (plum tangent). Jacobian genuinely state ke saath change hota hai — yahi wajah hai ki hum har step mein re-linearize karte hain.

L4.2 — Pendulum ke liye ek full predict step

Forward Euler ke saath use karo (toh discrete map hai ), aur , , se start karke mean aur covariance propagate karo.

Recall Solution

Mean (nonlinear ): , toh entry . Covariance — pehle, KYU discrete Jacobian hai. Covariance ko discrete one-step map ke slope se transport karna hoga. Iska Jacobian term-by-term lo: ka khud se derivative identity hai; ka derivative times ka khud ka Jacobian hai. Dono add karo: Yeh koi memorized formula nahi hai — yeh bas "Euler step differentiate karo" hai. (Yeh flow ka par first-order Taylor Series & Linearization hai.) Ab banao L4.1 se use karke par: , toh . , ke saath: Har entry carefully compute karo (row of dot row of ):

KYU split: mean ne real curve pe ride ki; uncertainty ne tangent pe ride ki via . Covariance ek second-moment object hai aur "" jaisi koi meaningful cheez nahi hai.


Level 5 — Mastery

L5.1 — Angle wrap ke saath full range/bearing measurement update

2D target, predicted state (toh ), , (range var , bearing var ). Radar ka raw reported bearing hai — Step 2 mein exactly dekho sensor ne kya bheja. Reported range hai. Correctly-wrapped angle innovation compute karo, phir innovation , , , aur posterior state.

Recall Solution

Step 1 — predicted measurement. , aur rad. Toh predicted bearing hai. Step 2 — sensor ne numerically kya bheja. True bearing error ek chhota rad hai. Lekin angle sensor values modulo report karta hai, aur is baar usne apni reading ko ke paas wrap kar liya: usne report kiya Agar tum naively subtract karo, toh raw residual hai Yeh ek bahut bada rad error jaisa lagta hai — lekin rad ka turn almost ek full circle hai, yaani essentially same direction. Real error tiny hai. Step 3 — bearing innovation ko mein wrap karo. Kyun? Do angles jo ek full turn se different hain woh same direction point karte hain; meaningful residual mein rehni chahiye. subtract karo: rad. atan2 & Angle Wrapping dekho. Step 4 — par Jacobian (L3.1 se): . Step 5 — innovation covariance . ke saath, : KYU cross terms vanish hote hain (yeh skip mat karo): off-diagonal ki do rows ka dot product hai — range gradient aur bearing gradient . Unka dot product hai : do rows orthogonal hain. Yeh luck nahi hai — range radially badhti hai jabki bearing tangentially badhti hai, aur radial aur tangential directions hamesha perpendicular hote hain. Toh ke saath mapped innovation covariance exactly diagonal hai is operating point par. Generally (koi bhi , ya alag ) yeh diagonal nahi hogi. Step 6 — invert karo aur gain form karo (kyunki ). Yahan diagonal hai, isliye bas diagonal ko reciprocate karta hai: Step 7 — posterior state : Step 8 — posterior covariance (update complete karta hai): Uncertainty se shrink hokar ho gayi har axis par — measurement ne genuinely estimate ko sharpen kiya. Interpretation: range surprise () estimate ko outward push karta hai; (chhota, correctly-wrapped) bearing surprise ise thoda nudge karta hai. Agar hum wrap nahi karte, toh bearing innovation estimate ko catastrophically throw kar deta — yahi wajah hai ki wrapping mandatory hai, cosmetic nahi.

Conditioning guard (general case). clean aur diagonal sirf isliye nikla kyunki tha aur ki rows yahan orthogonal thi. Real filter mein invert karne se pehle hamesha check karo: agar near zero hai (e.g. chhota range bearing row huge bana deta hai, ya do channels almost redundant ho jaate hain), toh noise amplify karta hai aur explode karta hai. Fix: explicitly form karne ki jagah ko stable linear solve (Cholesky) se solve karo, mein chhota jitter add karo regularize karne ke liye, aur har step mein / condition number monitor karo. Covariance Propagation dekho.

L5.2 — EKF ko bilkul abandon kab karoge?

Upar ke exercises se do concrete conditions bataao jahan EKF ka core assumption toot jaata hai, aur fix batao.

Recall Solution

Condition A — singular linearization (L3.2): ke paas bearing Jacobian blow up ho jaata hai () aur Taylor ke neglected terms dominate karne lagte hain. Fix: Unscented Kalman Filter (UKF) par switch karo (sample points use karta hai, koi Jacobian nahi) ya bearing channel skip karo. Condition B — large linearization error / bad initial guess: tangent sirf ke paas valid hai (parent-note mistake #5). Ek door ka seed ⇒ galat ⇒ divergence. Fix: ek achha seed karo, inflate karo, ya UKF use karo. Plain Kalman Filter (linear) se compare karo, jise yeh problem kabhi nahi hoti kyunki uska map exactly linear hai. KYU yeh same root cause hai: dono "curve ≈ line locally" ki failures hain. Jab tumhari uncertainty region par curvature chhoti nahi hai, first-order Taylor Series & Linearization simply kaafi accurate nahi hai.


Recall Feynman self-test (ek saanth mein bolo)

Ek 12-saal ke bacche ko explain karo kyun EKF guess ko real curved rule se push karta hai lekin uncertainty ko us rule ki flat straight-line copy se push karta hai ::: Kyunki tumhara single best guess real physics follow karna chahiye, lekin "tum kitne unsure ho" woh guess ke around ek chhota cloud hai — aur dekhne ke liye ki ek chhota cloud kaise stretch hota hai, tumhe sirf rule ki local steepness (slope) chahiye, jo flat tangent = Jacobian hai.