mf3.m
上传用户:szahd2008
上传日期:2020-09-25
资源大小:1275k
文件大小:3k
源码类别:

传真(Fax)编程

开发平台:

Matlab

  1. clear all
  2. bandwidth = 10e6;
  3. center_freq = 9.5e9;
  4. window = 1;
  5. range_bins = 1024;
  6. num_targets = 3;
  7. target_range = [200.0, 2000.0, 4000.0];
  8. target_rcs = [25.0, 10.0, 25.0];
  9. range_window = 5000;
  10. a2drate = 20e6;
  11. pulsewidth = 10.0e-6;
  12. time_bandwidth = pulsewidth*bandwidth
  13. c = 3.0e8;
  14. replica_samples = fix(a2drate*pulsewidth)
  15. sample_interval = 1.0/a2drate;
  16. range_window_time = 2*range_window/c + pulsewidth
  17. accumulator_samples = fix(a2drate * range_window_time)
  18. range_samples = accumulator_samples - replica_samples
  19. scalef = range_bins / range_samples
  20. fftsize = fix(scalef * accumulator_samples)
  21. %if fftsize < accumulator_samples
  22. %    window_size = fftsize;
  23. %else
  24. %    window_size = accumulator_samples
  25. %end
  26. window_size = replica_samples;
  27. window = zeros(1,window_size);
  28. % hamming window
  29. sum = 0.0;
  30. if window == 0
  31.     factor = 2.0 * pi / (window_size - 1);
  32.     for k = 0:window_size-1
  33.         window(k+1) = 0.54 - 0.46*cos(factor*k);
  34.     sum = sum + window(k+1);
  35.     end
  36.     sum = scalef/sum;
  37.     for k = 0:window_size - 1
  38.         window(k+1) = window(k+1)*sum;
  39.     end
  40. end
  41.     
  42.     % hamming window
  43. sum = 0.0;
  44. if window == 1
  45.     factor = 2.0 * pi / (window_size - 1);
  46.     for k=0:window_size - 1 
  47.         window(k+1) = 0.42 - 0.5*cos(factor*k) + 0.08*cos(2*factor*k);
  48.     sum = sum + window(k+1);
  49.     end
  50.     sum = 1.0/sum;
  51.     for k = 0:window_size-1
  52.         window(k+1) = window(k+1)*sum;
  53.     end
  54. end
  55. %t_replica = linspace(-0.5*pulsewidth, 0.5*pulsewidth, replica_samples);
  56. t_replica = linspace(0, pulsewidth, replica_samples);
  57. replica = zeros(1, accumulator_samples);
  58. for k = 1:replica_samples
  59.     replica(k) = window(k)*exp(i * pi * (bandwidth/pulsewidth) .* t_replica(k).^2);
  60. end
  61. figure(1)
  62. clf
  63. subplot(2,2,1)
  64. plot(real(replica))
  65. %replica = window .* replica;
  66. replica = fft(replica);
  67. %replica = fft(replica);
  68. subplot(2,2,2)
  69. plot(abs(replica))
  70. received = zeros(1,accumulator_samples);
  71. for i_t = 1:num_targets
  72.     
  73.     t1 = fix(2*target_range(i_t)/(sample_interval*c)) + 1;
  74.     t2 = t1 + replica_samples - 1;
  75.     
  76.     if t1 > accumulator_samples
  77.         continue
  78.     end
  79.     
  80.     if t2 < 1
  81.         continue
  82.     end
  83.         
  84.     if t1 < 1
  85.         t1 = 1;
  86.     end
  87.     if t2 > accumulator_samples
  88.         t2 = accumulator_samples;
  89.     end
  90.     t1
  91.     t2
  92.  
  93.     m = 1;
  94.     for k = t1:t2
  95.        received(accumulator_samples - k + 1) = received(accumulator_samples - k + 1) + target_rcs(i_t) .* exp(-i * pi * (bandwidth/pulsewidth) * (t_replica(m)^2));
  96.        m = m+1;
  97.     end
  98. end
  99. subplot(2,2,3)
  100. plot(real(received))
  101. received = fft(received);
  102. %received = fft(conj(received));
  103. subplot(2,2,4)
  104. plot(abs(received));
  105. y = replica.*received;
  106. y(:,accumulator_samples + 1:fftsize) = 0;
  107. figure(2)
  108. clf
  109. subplot(1,3,1)
  110. plot(abs(y))
  111. out = ifft(y);
  112. range = linspace(0.5*range_window_time*c, 0, fftsize);
  113. subplot(1,3,2)
  114. plot(abs(out));
  115. out2 = out(fftsize-range_bins+1:fftsize);
  116. %out2 = out(1:range_bins);
  117. range2 = linspace(range_window, 0, range_bins);
  118. subplot(1,3,3)
  119. plot(range2, abs(out2));