RectangularWaveform102.cpp 2.3 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: RectangularWaveform.cpp
  6. //
  7. // MATLAB Coder version : 5.3
  8. // C/C++ source code generated on : 26-Apr-2023 23:37:46
  9. //
  10. // Include Files
  11. #include "RectangularWaveform102.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 RectangularWaveform102::getMatchingWaveform(creal_T s[20000])
  24. {
  25. for (int k{0}; k < 20000; k++) {
  26. s[k].re = 1.0;
  27. s[k].im = 0.0;
  28. }
  29. }
  30. //
  31. // Arguments : void
  32. // Return Type : RectangularWaveform
  33. //
  34. RectangularWaveform102::RectangularWaveform102()
  35. {
  36. matlabCodegenIsDeleted = true;
  37. }
  38. //
  39. // Arguments : void
  40. // Return Type : void
  41. //
  42. RectangularWaveform102::~RectangularWaveform102()
  43. {
  44. matlabCodegenDestructor();
  45. }
  46. //
  47. // Arguments : void
  48. // Return Type : void
  49. //
  50. void RectangularWaveform102::matlabCodegenDestructor()
  51. {
  52. if (!matlabCodegenIsDeleted) {
  53. matlabCodegenIsDeleted = true;
  54. if (isInitialized == 1) {
  55. isInitialized = 2;
  56. }
  57. }
  58. }
  59. //
  60. // Arguments : creal_T varargout_1[60000]
  61. // Return Type : void
  62. //
  63. void RectangularWaveform102::step(creal_T varargout_1[60000])
  64. {
  65. static creal_T unusedExpr[20000];
  66. double d;
  67. double r;
  68. if (isInitialized != 1) {
  69. isSetupComplete = false;
  70. isInitialized = 1;
  71. isSetupComplete = true;
  72. pOutputStartPulseIndex = 1.0;
  73. pOutputPulseInterval[0] = 0.0;
  74. pOutputPulseInterval[1] = 1.0;
  75. }
  76. d = (pOutputStartPulseIndex + pOutputPulseInterval[1]) - 1.0;
  77. if (std::isnan(d) || std::isinf(d)) {
  78. r = rtNaN;
  79. } else if (d == 0.0) {
  80. r = 0.0;
  81. } else {
  82. r = std::fmod(d, 1.0);
  83. if (r == 0.0) {
  84. r = 0.0;
  85. } else if (d < 0.0) {
  86. r++;
  87. }
  88. }
  89. pOutputStartPulseIndex = r + 1.0;
  90. std::memset(&varargout_1[0], 0, 60000U * sizeof(creal_T));
  91. RectangularWaveform102::getMatchingWaveform(unusedExpr);
  92. std::copy(&unusedExpr[0], &unusedExpr[20000], &varargout_1[0]);
  93. RectangularWaveform102::getMatchingWaveform(unusedExpr);
  94. }
  95. } // namespace phased
  96. } // namespace coder
  97. //
  98. // File trailer for RectangularWaveform.cpp
  99. //
  100. // [EOF]
  101. //