Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Calculation of the distances for a FMCW Radar
- http://radartutorial.de/02.basics/Frequency%20Modulated%20Continuous%20Wave%20Radar.en.html
- R = (c0 · |Δf|) / (2 · (df/dt))
- Condition
- =========
- A chirp has the length of the window_size
- """
- def radar_range(sampling_rate, bandwidth, window_size):
- delta_t = 1 / sampling_rate * window_size
- chirp = bandwidth / delta_t
- dist = lambda fB: (3e8 * fB) / (2 * chirp)
- return [round(dist(sampling_rate / window_size * n), 2) for n in range(window_size // 2 + 1)]
- def radar_range_simple(bandwidth, window_size):
- dist_step = 3e8 / bandwidth / 2
- return [round(dist_step * n, 2) for n in range(window_size // 2 + 1)]
- low_sampling_rate = 122_880 # S/s
- high_sampling_rate = 2_000_000 # S/s
- window_size = 64 # Samples
- bandwidth = 180e6 # MHz
- dists1 = radar_range(low_sampling_rate, bandwidth, window_size)
- dists2 = radar_range(high_sampling_rate, bandwidth, window_size)
- dists3 = radar_range_simple(bandwidth, window_size)
- if dists1 == dists2 == dists3:
- print('Both functions returns equal distances')
- # Conclusion: The sampling_rate does not affect the resolution.
- # The higher the sampling rate, the shorter the chirp, the higher the beat frequency for same distance
- # I hope I got everything right
Add Comment
Please, Sign In to add comment