This project simulates an FMCW automotive radar and detects a moving target using:
- FMCW waveform generation
- Range FFT (1D FFT)
- Range-Doppler Map generation (2D FFT)
- 2D CFAR thresholding to isolate target detections from noise
The implementation is in radar.m.
Generated figures:
These visualize range estimation, range-doppler response, and final CFAR detections respectively.
The simulation uses the following requirements:
- Carrier frequency: 77 GHz
- Maximum range: 200 m
- Range resolution: 1 m
- Maximum velocity: 70 m/s
Target motion used in the script:
- Initial range: 110 m
- Velocity: -20 m/s (approaching radar)
- Generate FMCW chirps from radar specifications.
- Simulate transmitted and received signals over time.
- Mix Tx and Rx to obtain beat signal.
- Run 1D FFT for range estimation.
- Run 2D FFT to produce the Range-Doppler Map (RDM).
- Apply 2D CFAR to the RDM for binary target detection.
The CFAR process is implemented as follows:
- Convert local RDM window values from dB to linear power
- For each Cell Under Test (CUT), define a rectangular window that includes:
- Training cells (background/noise estimate)
- Guard cells (buffer around CUT to prevent target leakage)
- Sum power in the full training+guard window.
- Subtract guard-window power from total window power to keep only training-cell power.
- Average by the number of training cells to estimate local noise power.
- Convert the average noise power back to dB
- Add a fixed offset (SNR margin) to form the detection threshold.
- Compare CUT value against threshold:
- If CUT > threshold, mark detection = 1
- Else, detection = 0
Current values:
- Training cells: Tr = 10, Td = 8
- Guard cells: Gr = 4, Gd = 4
- Offset: 6 dB
Why these values are reasonable:
- Training cells must be large enough to estimate local noise robustly.
- Guard cells must be large enough to isolate the target main lobe from training statistics.
- Offset controls false alarms versus missed detections:
- Lower offset: more sensitive, potentially noisier output.
- Higher offset: cleaner output, but risk of suppressing weaker targets.
CFAR cannot be evaluated at map boundaries because a full training+guard window does not fit around those CUTs.
To keep output size equal to the original RDM while removing undefined regions:
- Run CFAR only where a full window is valid.
- Leave edge regions as non-detections (0).
- Explicitly set boundary bands to 0 in the CFAR matrix using margins:
- Top and bottom bands: Tr + Gr rows
- Left and right bands: Td + Gd columns
This ensures:
- No invalid thresholding at edges
- Output dimensions remain unchanged
- Cleaner and consistent binary detection map


