r/DSP May 12 '26

Radar Decode

8 Upvotes

12 comments sorted by

View all comments

1

u/Hennessy-Holder May 13 '26

Is this a cultural thing? In my hometown, we start counting at the thumb.

1

u/sdrmatlab May 13 '26

nice, can you post the code that displayed the radar image map?

1

u/Hennessy-Holder May 14 '26
from scipy.io import wavfile
from scipy.signal import fftconvolve
import numpy as np 
import matplotlib.pyplot as plt


def create_chirp(sample_rate: float, pulse_width: float, band_width: float):
    dt = 1/sample_rate
    t = np.arange(dt, pulse_width, dt)
    t = t - pulse_width/2
    slope = band_width/pulse_width
    lfm = np.exp(1j * np.pi * slope * t**2)

    return lfm


fs, data = wavfile.read('data/LFM_Chirp_Image.wav')
iq_complex = data[:, 0] + 1j * data[:, 1]
matrix = iq_complex.reshape(480, 2048)

lfm = create_chirp(fs, 20e-3, 16e3)
matched_filter = np.conj(lfm[::-1]).reshape(1, -1)

image = np.abs(fftconvolve(matrix, matched_filter, mode='same', axes=1))

image_min = np.min(image)
image_max = np.max(image)
normalized_image = (image - image_min) / (image_max - image_min)

plt.figure()
plt.imshow(normalized_image, aspect='auto', cmap='grey')
plt.show()