# MEMORY

This file is the durable handoff for AI agents working in this repository. Keep it short, factual, and current. If it ever drifts from the source docs or code, update this file to match the real source of truth.

## File Roles

- `MEMORY.md` stores durable project context: guardrails, sourced facts, assumptions, decisions, code status, and verification notes.
- `TODO.md` stores the active execution queue and the current critical path.
- Do not turn `TODO.md` into a second memory file or turn `MEMORY.md` into a running checklist.

## Guardrails

- Treat `/docs` and direct instructor clarifications as authoritative for assignment requirements and parameter values.
- Do not invent missile or target thrust, mass, drag, or geometry tables. Transcribe them from the source packet and note what was extracted.
- Preserve SI units unless a document explicitly states otherwise.
- Keep [`code/Interceptor_3DOF.m`](./code/Interceptor_3DOF.m) as the primary entry point unless there is an intentional repo-wide refactor.
- When implementing the atmosphere helper, include the stratosphere branch for altitude `> 11 km`.
- Do not describe the model as runnable until all `XX` placeholders are replaced and `getRho.m` exists.
- Record every meaningful assumption, extracted constant, unresolved issue, and verification result here.
- Keep `TODO.md` aligned with the current critical path, but keep durable context and decisions in this file.
- Use exact dates in status notes.
- Do not store secrets, tokens, or personal data in this file.

## Current Snapshot

- Date: `2026-03-28`
- Project: MATLAB 3DOF interceptor-versus-target engagement assignment for AERO 3220 Spring 2026.
- Source docs reviewed:
  - `docs/AERO 3220 3DOF Information Spring 26.pdf`
  - `docs/Atmosphere Model SI Units.pdf`
  - `docs/Addendum to Atomosphere Model Feb 26.pdf`
  - `docs/Missile and Target Data for 3DOF Spring 26.pdf`
- Instructor clarification documented on `2026-03-28`:
  - The atmosphere model must be written and integrated into the simulation.
  - The atmosphere implementation must include the stratosphere model for altitude `> 11 km`.
  - The code will not run until the missing `XX` values are replaced with real numbers.
- Stratosphere model confirmed from `docs/Addendum to Atomosphere Model Feb 26.pdf`:
  - For `z > 11000 m`, use `T = T0 + lapserate*(11000 - z0)`, so temperature is constant above `11 km`.
  - Compute `P11k = P0*(T/T0)^(-g/(lapserate*R))`.
  - Compute `P = P11k*exp(-g*(z - 11000)/(R*T))`.
  - Then compute `rho = P/(R*T)` and `acousticSpeed = sqrt(gamma*R*T)`.
- Assignment baseline confirmed from the handout:
  - Velocity pursuit guidance gain = `0.5`
  - Blind range = `2 m`
  - Acquisition range = `5000 m`
  - Lateral acceleration limit = `40 g`
  - Velocity-pursuit guidance start delay = `0.5 s` after missile launch
  - Terminal proportional-navigation gain = `4`
  - Commit time = `50 s`
  - Missile initial elevation angle = `40 deg`
- Required plots confirmed:
  - Target/missile vertical-plane trajectories
  - Target speed versus time
  - Missile speed versus time
  - Missile Mach number versus time
  - Missile acceleration magnitude versus time since missile launch

## Code Status

- [`code/Interceptor_3DOF.m`](./code/Interceptor_3DOF.m) drives the integration loop, plotting, and CSV export.
- [`code/T3dxdt.m`](./code/T3dxdt.m), [`code/M3dxdt.m`](./code/M3dxdt.m), and [`code/getGuidance.m`](./code/getGuidance.m) still contain `XX` placeholders.
- `getRho.m` is referenced by the driver and both dynamics functions, but the file is missing.
- Because `getRho.m` does not exist yet, neither the lower-atmosphere branch nor the addendum-defined stratosphere branch for `z > 11 km` is implemented in the repo.
- [`code/getMD.m`](./code/getMD.m) exists and computes miss distance at the point of closest approach.
- The missile/target data PDF appears image-based; a future agent should log the extraction method used when those tables are transcribed.

## Next Actions

1. Implement `getRho.m` and integrate it into the simulation, including the required stratosphere branch for altitude `> 11 km`.
2. Transcribe missile and target geometry, thrust, mass, and drag data from the missile/target packet.
3. Replace all remaining `XX` placeholders with sourced values.
4. Run the MATLAB model and verify the required plots and CSV outputs.

## Update Protocol For Agents

After any meaningful change, update:

- `Current Snapshot` if assumptions, sourced values, or operating context changed.
- `Code Status` if files were added, edited, or made runnable.
- `Next Actions` only if the durable sequencing changed in a meaningful way.
- `TODO.md` if the active work queue or current critical path changed.
- `Change Log` with a short dated note.

## Change Log

- `2026-03-28`: Created `README.md` and `MEMORY.md` from the `/docs` PDFs and current MATLAB code. Confirmed the repo is still an incomplete assignment skeleton with unresolved placeholders and a missing `getRho.m`.
- `2026-03-28`: Documented professor guidance that the atmosphere model must be integrated into the simulation, must include the stratosphere branch for altitude `> 11 km`, and will not run until the `XX` placeholders are replaced.
- `2026-03-28`: Clarified file roles so `MEMORY.md` is the durable handoff and `TODO.md` is the active execution tracker.
- `2026-03-28`: Confirmed the stratosphere equations from `docs/Addendum to Atomosphere Model Feb 26.pdf` and recorded the required `z > 11000 m` branch for the future `getRho.m` implementation.
