RadarSignalGenerator402.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // Academic License - for use in teaching, academic research, and meeting
  3. // course requirements at degree granting institutions only. Not for
  4. // government, commercial, or other organizational use.
  5. // File: RadarSignalGenerator402.cpp
  6. //
  7. // MATLAB Coder version : 5.3
  8. // C/C++ source code generated on : 27-Apr-2023 00:11:07
  9. //
  10. // Include Files
  11. #include "RadarSignalGenerator402.h"
  12. #include "FMCWWaveform402.h"
  13. #include "../rt_nonfinite.h"
  14. #include "../coder_array.h"
  15. #include <cmath>
  16. // Function Definitions
  17. //
  18. // RADARSIGNALGENERATOR1 此处显示有关此函数的摘要
  19. // 此处显示详细说明
  20. //
  21. // Arguments : coder::array<double, 1U> &sig
  22. // double *fs
  23. // double *PRF
  24. // double *len
  25. // Return Type : void
  26. //
  27. void RadarSignalGenerator402(coder::array<double, 1U> &sig, double *fs,
  28. double *PRF, double *len)
  29. {
  30. static coder::phased::FMCWWaveform402 wavGen;
  31. static creal_T xt[60000];
  32. static double b_xt[60000];
  33. double idx;
  34. int i;
  35. int ii;
  36. int loop_ub_tmp;
  37. // simTime = 2e-5;
  38. wavGen.isInitialized = 0;
  39. // 产生5个脉冲
  40. // numPulses = fix(simTime*PRF);
  41. *len = 0.0;
  42. for (ii = 0; ii < 5; ii++) {
  43. *len += 60000.0;
  44. }
  45. loop_ub_tmp = static_cast<int>(*len);
  46. sig.set_size(loop_ub_tmp);
  47. for (i = 0; i < loop_ub_tmp; i++) {
  48. sig[i] = 0.0;
  49. }
  50. idx = 1.0;
  51. for (ii = 0; ii < 5; ii++) {
  52. double kd;
  53. int i1;
  54. // 迭代波形
  55. wavGen.step(xt);
  56. // 载波调制
  57. b_xt[0] = 0.0;
  58. b_xt[59999] = 2.99995E-6;
  59. for (loop_ub_tmp = 0; loop_ub_tmp < 29998; loop_ub_tmp++) {
  60. kd = (static_cast<double>(loop_ub_tmp) + 1.0) * 5.0E-11;
  61. b_xt[loop_ub_tmp + 1] = kd;
  62. b_xt[59998 - loop_ub_tmp] = 2.99995E-6 - kd;
  63. }
  64. b_xt[29999] = 1.4999500000000001E-6;
  65. b_xt[30000] = 1.4999999999999998E-6;
  66. for (loop_ub_tmp = 0; loop_ub_tmp < 60000; loop_ub_tmp++) {
  67. double b_re_tmp;
  68. double im;
  69. double re_tmp;
  70. im = b_xt[loop_ub_tmp] * 5.969026041820607E+10;
  71. if (im == 0.0) {
  72. kd = 1.0;
  73. im = 0.0;
  74. } else {
  75. kd = std::cos(im);
  76. im = std::sin(im);
  77. }
  78. re_tmp = xt[loop_ub_tmp].re;
  79. b_re_tmp = xt[loop_ub_tmp].im;
  80. xt[loop_ub_tmp].re = re_tmp * kd - b_re_tmp * im;
  81. xt[loop_ub_tmp].im = re_tmp * im + b_re_tmp * kd;
  82. }
  83. if (idx > (idx + 60000.0) - 1.0) {
  84. i = -1;
  85. i1 = -59999;
  86. } else {
  87. i = static_cast<int>(idx) - 2;
  88. i1 = static_cast<int>(static_cast<unsigned int>(idx));
  89. }
  90. for (loop_ub_tmp = 0; loop_ub_tmp < 60000; loop_ub_tmp++) {
  91. b_xt[loop_ub_tmp] = xt[loop_ub_tmp].re;
  92. }
  93. loop_ub_tmp = (i1 - i) + 59998;
  94. for (i1 = 0; i1 < loop_ub_tmp; i1++) {
  95. sig[(i + i1) + 1] = b_xt[i1];
  96. }
  97. idx += 60000.0;
  98. }
  99. *fs = 2.0E+10;
  100. *PRF = 333333.33333333331;
  101. }
  102. //
  103. // File trailer for RadarSignalGenerator402.cpp
  104. //
  105. // [EOF]
  106. //