% processing doppler for pulse train  
 clear
% radar parameters
 N=16;        % number of pulses in train
 tau=150e-6;  % pulse width
 fp=2300;     % PRF
 Tp=1/fp;     % interpulse period
 dr=tau;      % range bin size (= pulse width)
 T=N*Tp;      % total observation time
 df=1/T;      % frequency increment 
 fc=1e9;      % carrier frequency
 wave=3e8/fc;
% assume 2 targets and assign velocities v1 and v2
 v=45; fd=2*v/wave;
% initialize all I and Q to zero
 M=1;  % only look at 1 range bin in this version
 I=zeros(N,M); Q=zeros(N,M);
% pulse loop
  for n=1:N
     tm=(n-1)*Tp;
     T(n)=tm/1e-3;
     I(n)=cos(2*pi*fd*tm);
     Q(n)=sin(2*pi*fd*tm);
  end
  figure(1)
  subplot(211)
  plot(T,I,'-x',T,Q,'r-o')
  xlabel('Time, ms')
  ylabel('Normalized Samples')
  legend('I','Q')
%------------- I and Q signals generated --------------------------------
 A=I(:,1)+j*Q(:,1);
 B=fft(A); As=fftshift(B);
% keep negative frequencies
 F=[-N/2:N/2-1]*df;
 subplot(212)
 plot(F,abs(As)',F,abs(As)','o')
 xlabel('Doppler Frequency (Hz)')
 ylabel('Filter Output')
 

