PhaseCodedWaveform202.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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: PhaseCodedWaveform.cpp
  6. //
  7. // MATLAB Coder version : 5.3
  8. // C/C++ source code generated on : 26-Apr-2023 23:50:19
  9. //
  10. // Include Files
  11. #include "PhaseCodedWaveform202.h"
  12. #include "../rt_nonfinite.h"
  13. #include <algorithm>
  14. #include <cmath>
  15. #include <cstring>
  16. // Function Definitions
  17. //
  18. // Arguments : creal_T s[20000]
  19. // Return Type : void
  20. //
  21. namespace coder {
  22. namespace phased {
  23. void PhaseCodedWaveform202::getMatchingWaveform(creal_T s[20000])
  24. {
  25. int ibtile;
  26. int k;
  27. signed char b_s[20000];
  28. signed char c_s[20000];
  29. for (k = 0; k < 5000; k++) {
  30. ibtile = k << 2;
  31. b_s[ibtile] = 1;
  32. b_s[ibtile + 1] = 1;
  33. b_s[ibtile + 2] = -1;
  34. b_s[ibtile + 3] = 1;
  35. }
  36. for (k = 0; k < 20000; k++) {
  37. s[k].re = 1.0;
  38. s[k].im = 0.0;
  39. }
  40. for (k = 0; k < 4; k++) {
  41. for (ibtile = 0; ibtile < 5000; ibtile++) {
  42. c_s[ibtile + 5000 * k] = b_s[k + (ibtile << 2)];
  43. }
  44. }
  45. for (k = 0; k < 20000; k++) {
  46. ibtile = c_s[k];
  47. s[k].re *= static_cast<double>(ibtile);
  48. s[k].im *= static_cast<double>(ibtile);
  49. }
  50. }
  51. //
  52. // Arguments : void
  53. // Return Type : PhaseCodedWaveform
  54. //
  55. PhaseCodedWaveform202::PhaseCodedWaveform202()
  56. {
  57. matlabCodegenIsDeleted = true;
  58. }
  59. //
  60. // Arguments : void
  61. // Return Type : void
  62. //
  63. PhaseCodedWaveform202::~PhaseCodedWaveform202()
  64. {
  65. matlabCodegenDestructor();
  66. }
  67. //
  68. // Arguments : void
  69. // Return Type : void
  70. //
  71. void PhaseCodedWaveform202::matlabCodegenDestructor()
  72. {
  73. if (!matlabCodegenIsDeleted) {
  74. matlabCodegenIsDeleted = true;
  75. if (isInitialized == 1) {
  76. isInitialized = 2;
  77. }
  78. }
  79. }
  80. //
  81. // Arguments : creal_T varargout_1[60000]
  82. // Return Type : void
  83. //
  84. void PhaseCodedWaveform202::step(creal_T varargout_1[60000])
  85. {
  86. static creal_T unusedExpr[20000];
  87. double d;
  88. double r;
  89. if (isInitialized != 1) {
  90. isSetupComplete = false;
  91. isInitialized = 1;
  92. isSetupComplete = true;
  93. TunablePropsChanged = false;
  94. pOutputStartPulseIndex = 1.0;
  95. pOutputPulseInterval[0] = 0.0;
  96. pOutputPulseInterval[1] = 1.0;
  97. }
  98. if (TunablePropsChanged) {
  99. TunablePropsChanged = false;
  100. }
  101. d = (pOutputStartPulseIndex + pOutputPulseInterval[1]) - 1.0;
  102. if (std::isnan(d) || std::isinf(d)) {
  103. r = rtNaN;
  104. } else if (d == 0.0) {
  105. r = 0.0;
  106. } else {
  107. r = std::fmod(d, 1.0);
  108. if (r == 0.0) {
  109. r = 0.0;
  110. } else if (d < 0.0) {
  111. r++;
  112. }
  113. }
  114. pOutputStartPulseIndex = r + 1.0;
  115. std::memset(&varargout_1[0], 0, 60000U * sizeof(creal_T));
  116. PhaseCodedWaveform202::getMatchingWaveform(unusedExpr);
  117. std::copy(&unusedExpr[0], &unusedExpr[20000], &varargout_1[0]);
  118. PhaseCodedWaveform202::getMatchingWaveform(unusedExpr);
  119. }
  120. } // namespace phased
  121. } // namespace coder
  122. //
  123. // File trailer for PhaseCodedWaveform.cpp
  124. //
  125. // [EOF]
  126. //