123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- //
- // Academic License - for use in teaching, academic research, and meeting
- // course requirements at degree granting institutions only. Not for
- // government, commercial, or other organizational use.
- // File: RectangularWaveform.cpp
- //
- // MATLAB Coder version : 5.3
- // C/C++ source code generated on : 26-Apr-2023 23:37:46
- //
- // Include Files
- #include "RectangularWaveform102.h"
- #include "../rt_nonfinite.h"
- #include <algorithm>
- #include <cmath>
- #include <cstring>
- // Function Definitions
- //
- // Arguments : creal_T s[20000]
- // Return Type : void
- //
- namespace coder {
- namespace phased {
- void RectangularWaveform102::getMatchingWaveform(creal_T s[20000])
- {
- for (int k{0}; k < 20000; k++) {
- s[k].re = 1.0;
- s[k].im = 0.0;
- }
- }
- //
- // Arguments : void
- // Return Type : RectangularWaveform
- //
- RectangularWaveform102::RectangularWaveform102()
- {
- matlabCodegenIsDeleted = true;
- }
- //
- // Arguments : void
- // Return Type : void
- //
- RectangularWaveform102::~RectangularWaveform102()
- {
- matlabCodegenDestructor();
- }
- //
- // Arguments : void
- // Return Type : void
- //
- void RectangularWaveform102::matlabCodegenDestructor()
- {
- if (!matlabCodegenIsDeleted) {
- matlabCodegenIsDeleted = true;
- if (isInitialized == 1) {
- isInitialized = 2;
- }
- }
- }
- //
- // Arguments : creal_T varargout_1[60000]
- // Return Type : void
- //
- void RectangularWaveform102::step(creal_T varargout_1[60000])
- {
- static creal_T unusedExpr[20000];
- double d;
- double r;
- if (isInitialized != 1) {
- isSetupComplete = false;
- isInitialized = 1;
- isSetupComplete = true;
- pOutputStartPulseIndex = 1.0;
- pOutputPulseInterval[0] = 0.0;
- pOutputPulseInterval[1] = 1.0;
- }
- d = (pOutputStartPulseIndex + pOutputPulseInterval[1]) - 1.0;
- if (std::isnan(d) || std::isinf(d)) {
- r = rtNaN;
- } else if (d == 0.0) {
- r = 0.0;
- } else {
- r = std::fmod(d, 1.0);
- if (r == 0.0) {
- r = 0.0;
- } else if (d < 0.0) {
- r++;
- }
- }
- pOutputStartPulseIndex = r + 1.0;
- std::memset(&varargout_1[0], 0, 60000U * sizeof(creal_T));
- RectangularWaveform102::getMatchingWaveform(unusedExpr);
- std::copy(&unusedExpr[0], &unusedExpr[20000], &varargout_1[0]);
- RectangularWaveform102::getMatchingWaveform(unusedExpr);
- }
- } // namespace phased
- } // namespace coder
- //
- // File trailer for RectangularWaveform.cpp
- //
- // [EOF]
- //
|