123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- //
- // 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: FMCWWaveform401.cpp
- //
- // MATLAB Coder version : 5.3
- // C/C++ source code generated on : 27-Apr-2023 00:06:45
- //
- // Include Files
- #include "FMCWWaveform401.h"
- #include "../rt_nonfinite.h"
- #include "../coder_array.h"
- #include <cmath>
- #include <cstring>
- // Function Definitions
- //
- // Arguments : void
- // Return Type : void
- //
- namespace coder {
- namespace phased {
- void FMCWWaveform401::setupImpl()
- {
- static const double dv[3]{2.0E-6, 3.0E-6, 4.0E-6};
- array<creal_T, 1U> r1;
- array<double, 1U> a;
- array<double, 1U> c_y;
- array<int, 2U> b_r;
- array<int, 2U> b_y;
- array<int, 2U> y;
- std::memset(&pSamples[0], 0, 180000U * sizeof(creal_T));
- for (int m{0}; m < 3; m++) {
- double r;
- int k;
- int nx;
- int vlen;
- if (m == 0) {
- nx = 0;
- } else {
- nx = m;
- }
- nx *= 20000;
- y.set_size(1, nx + 40000);
- for (k = 0; k <= nx + 39999; k++) {
- y[k] = k;
- }
- if (1 > m) {
- vlen = 0;
- } else {
- vlen = m;
- }
- if (m == 0) {
- nx = 0;
- } else {
- nx = m;
- }
- nx *= 20000;
- b_y.set_size(1, nx + 40000);
- for (k = 0; k <= nx + 39999; k++) {
- b_y[k] = k + 1;
- }
- if (vlen == 0) {
- r = 0.0;
- } else {
- r = 40000.0;
- for (k = 2; k <= vlen; k++) {
- r += 60000.0;
- }
- }
- b_r.set_size(1, b_y.size(1));
- nx = b_y.size(1);
- for (k = 0; k < nx; k++) {
- b_r[k] = static_cast<int>(static_cast<double>(b_y[k]) + r);
- }
- if (m == 0) {
- nx = 0;
- } else {
- nx = m;
- }
- r = 1.0E+9 / dv[nx] * 3.1415926535897931;
- a.set_size(y.size(1));
- nx = y.size(1);
- for (k = 0; k < nx; k++) {
- a[k] = static_cast<double>(y[k]) / 2.0E+10;
- }
- c_y.set_size(a.size(0));
- nx = a.size(0);
- for (k = 0; k < nx; k++) {
- c_y[k] = a[k] * a[k];
- }
- r1.set_size(c_y.size(0));
- nx = c_y.size(0);
- for (k = 0; k < nx; k++) {
- r1[k].re = 0.0;
- r1[k].im = c_y[k] * r;
- }
- nx = r1.size(0);
- for (k = 0; k < nx; k++) {
- if (r1[k].im == 0.0) {
- r1[k].re = std::exp(r1[k].re);
- r1[k].im = 0.0;
- } else if (std::isinf(r1[k].im) && std::isinf(r1[k].re) &&
- (r1[k].re < 0.0)) {
- r1[k].re = 0.0;
- r1[k].im = 0.0;
- } else {
- r = std::exp(r1[k].re / 2.0);
- r1[k].re = r * (r * std::cos(r1[k].im));
- r1[k].im = r * (r * std::sin(r1[k].im));
- }
- }
- nx = b_r.size(1);
- for (k = 0; k < nx; k++) {
- pSamples[b_r[k] - 1] = r1[k];
- }
- }
- }
- } // namespace phased
- } // namespace coder
- //
- // File trailer for FMCWWaveform401.cpp
- //
- // [EOF]
- //
|