12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- //
- // 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: RadarSignalGenerator.cpp
- //
- // MATLAB Coder version : 5.3
- // C/C++ source code generated on : 25-Apr-2023 21:10:09
- //
- // Include Files
- #include "RadarSignalGenerator.h"
- #include "LinearFMWaveform.h"
- #include "../rt_nonfinite.h"
- #include <cmath>
- // Function Definitions
- //
- // RADARSIGNALGENERATOR1 此处显示有关此函数的摘要
- // 此处显示详细说明
- //
- // Arguments : double sig[400000]
- // double *fs
- // double *PRF
- // Return Type : void
- //
- void RadarSignalGenerator001(double sig[400000], double *fs, double *PRF)
- {
- static creal_T xt[80000];
- static double dv[80000];
- coder::phased::LinearFMWaveform wavGen;
- // simTime = 2e-5;
- *fs = 4.0E+9;
- *PRF = 49999.999999999993;
- wavGen.isInitialized = 0;
- wavGen.matlabCodegenIsDeleted = false;
- // 相位编码定义
- // 每次迭代产生一次脉冲数据,算出仿真时间内的脉冲数
- // numPulses = fix(simTime*PRF);
- for (int ii{0}; ii < 5; ii++) {
- double kd;
- int k;
- // 迭代波形
- wavGen.step(xt);
- // 载波调制
- dv[0] = 0.0;
- dv[79999] = 1.999975E-5;
- for (k = 0; k < 39998; k++) {
- kd = (static_cast<double>(k) + 1.0) * 2.5E-10;
- dv[k + 1] = kd;
- dv[79998 - k] = 1.999975E-5 - kd;
- }
- dv[39999] = 9.99975E-6;
- dv[40000] = 1.0E-5;
- for (k = 0; k < 80000; k++) {
- double b_re_tmp;
- double im;
- double re;
- double re_tmp;
- im = dv[k] * 6.2831853071795864E+9;
- if (im == 0.0) {
- kd = 1.0;
- im = 0.0;
- } else {
- kd = std::cos(im);
- im = std::sin(im);
- }
- re_tmp = xt[k].re;
- b_re_tmp = xt[k].im;
- re = re_tmp * kd - b_re_tmp * im;
- xt[k].re = re;
- xt[k].im = re_tmp * im + b_re_tmp * kd;
- sig[k + 80000 * ii] = re;
- }
- }
- }
- //
- // File trailer for RadarSignalGenerator.cpp
- //
- // [EOF]
- //
|