diff --git a/Copy_of_EKF_Est_Sim_334.ipynb b/Copy_of_EKF_Est_Sim_334.ipynb index a935f71..c9e337f 100644 --- a/Copy_of_EKF_Est_Sim_334.ipynb +++ b/Copy_of_EKF_Est_Sim_334.ipynb @@ -77,7 +77,8 @@ " w = np.linalg.cholesky([[SigmaW]]).T @ np.random.randn(1)\n", " v = np.linalg.cholesky([[SigmaV]]).T @ np.random.randn(1)\n", " ztrue = xtrue.item()**3 + v.item() # Convert to scalar\n", - " xtrue = np.sqrt(5 + xtrue.item()) + w.item() # Convert to scalar\n", + " safe_val = max(-5, xtrue.item())\n", + " xtrue = np.sqrt(5 + safe_val) + w.item() # Convert to scalar\n", "\n", " # KF Step 3: Estimate system output\n", " Chat = 3 * xhat**2\n",