123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- //
- // 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: RadarSignalGenerator103.cpp
- //
- // MATLAB Coder version : 5.3
- // C/C++ source code generated on : 26-Apr-2023 23:41:22
- //
- // Include Files
- #include "RadarSignalGenerator103.h"
- #include "RectangularWaveform103.h"
- #include "../coder_array.h"
- #include <algorithm>
- #include <cmath>
- #include <cstring>
- // Function Definitions
- //
- // RADARSIGNALGENERATOR1 此处显示有关此函数的摘要
- // 此处显示详细说明
- //
- // Arguments : coder::array<double, 1U> &sig
- // double *fs
- // double *PRF
- // double *len
- // Return Type : void
- //
- void RadarSignalGenerator103(coder::array<double, 1U> &sig, double *fs,
- double *PRF, double *len)
- {
- static creal_T xt[40000];
- static double b_xt[40000];
- coder::phased::RectangularWaveform103 wavGen;
- creal_T unusedExpr[10000];
- double idx;
- int i;
- int ii;
- int loop_ub_tmp;
- // simTime = 2e-5;
- // 方波定义
- wavGen.isInitialized = 0;
- wavGen.matlabCodegenIsDeleted = false;
- // 线性调频波定义
- // 产生4个脉冲
- // numPulses = fix(simTime*PRF);
- *len = 0.0;
- for (ii = 0; ii < 5; ii++) {
- *len += 40000.0;
- }
- loop_ub_tmp = static_cast<int>(*len);
- sig.set_size(loop_ub_tmp);
- for (i = 0; i < loop_ub_tmp; i++) {
- sig[i] = 0.0;
- }
- idx = 1.0;
- wavGen.pOutputStartPulseIndex = 1.0;
- for (ii = 0; ii < 5; ii++) {
- double kd;
- int i1;
- // 迭代波形
- if (wavGen.isInitialized != 1) {
- wavGen.isInitialized = 1;
- wavGen.isSetupComplete = true;
- wavGen.pOutputPulseInterval[0] = 0.0;
- wavGen.pOutputPulseInterval[1] = 1.0;
- }
- std::memset(&xt[0], 0, 40000U * sizeof(creal_T));
- coder::phased::RectangularWaveform103::getMatchingWaveform(unusedExpr);
- std::copy(&unusedExpr[0], &unusedExpr[10000], &xt[0]);
- coder::phased::RectangularWaveform103::getMatchingWaveform(unusedExpr);
- // 载波调制
- b_xt[0] = 0.0;
- b_xt[39999] = 1.99995E-6;
- for (loop_ub_tmp = 0; loop_ub_tmp < 19998; loop_ub_tmp++) {
- kd = (static_cast<double>(loop_ub_tmp) + 1.0) * 5.0E-11;
- b_xt[loop_ub_tmp + 1] = kd;
- b_xt[39998 - loop_ub_tmp] = 1.99995E-6 - kd;
- }
- b_xt[19999] = 9.9995E-7;
- b_xt[20000] = 9.9999999999999974E-7;
- for (loop_ub_tmp = 0; loop_ub_tmp < 40000; loop_ub_tmp++) {
- double b_re_tmp;
- double im;
- double re_tmp;
- im = b_xt[loop_ub_tmp] * 5.969026041820607E+10;
- if (im == 0.0) {
- kd = 1.0;
- im = 0.0;
- } else {
- kd = std::cos(im);
- im = std::sin(im);
- }
- re_tmp = xt[loop_ub_tmp].re;
- b_re_tmp = xt[loop_ub_tmp].im;
- xt[loop_ub_tmp].re = re_tmp * kd - b_re_tmp * im;
- xt[loop_ub_tmp].im = re_tmp * im + b_re_tmp * kd;
- }
- if (idx > (idx + 40000.0) - 1.0) {
- i = -1;
- i1 = -39999;
- } else {
- i = static_cast<int>(idx) - 2;
- i1 = static_cast<int>(static_cast<unsigned int>(idx));
- }
- for (loop_ub_tmp = 0; loop_ub_tmp < 40000; loop_ub_tmp++) {
- b_xt[loop_ub_tmp] = xt[loop_ub_tmp].re;
- }
- loop_ub_tmp = (i1 - i) + 39998;
- for (i1 = 0; i1 < loop_ub_tmp; i1++) {
- sig[(i + i1) + 1] = b_xt[i1];
- }
- idx += 40000.0;
- }
- wavGen.matlabCodegenDestructor();
- *fs = 2.0E+10;
- *PRF = 500000.0;
- }
- //
- // File trailer for RadarSignalGenerator103.cpp
- //
- // [EOF]
- //
|