binarySequence = randi([0, 1], 1, N);
waveform = phased.RectangularWaveform('PulseWidth', PW, 'PRF', PRF, 'SampleRate', Fs);
pulseTrain = repmat(waveform(), 1, N);
binarySequenceRepeated = repelem(binarySequence, length(pulseTrain) / N);
modulatedPulseTrain = pskmod(binarySequenceRepeated, 2, pi);
tx = phased.Transmitter('Gain',20);
rx = phased.ReceiverPreamp('Gain',20,'NoiseFigure',10);
received = zeros(length(modulatedPulseTrain), numPulses);
transmitted = tx(modulatedPulseTrain(:, p));
received(:, p) = rx(transmitted);
doppler_shift = 2*(target_velocity/physconst('LightSpeed'))*waveform.PRF;
received(:, p) = received(:, p) .* exp(1j*2*pi*doppler_shift*(0:length(received(:, p))-1)/Fs).';
rdmap = phased.RangeDopplerResponse('RangeMethod','FFT','DopplerOutput','Speed',...
'OperatingFrequency',300e6,'SampleRate',Fs,'DopplerFFTLengthSource','Property',...
'DopplerFFTLength',numPulses,'RangeFFTLengthSource','Property',...
'RangeFFTLength',length(modulatedPulseTrain));
[resp, range_grid, speed_grid] = rdmap(received);
resp = 10*log10(resp/max(resp(:)));
imagesc(speed_grid, range_grid*physconst('LightSpeed')/2, resp, [-40 0]);
title('Range-Doppler Map');