// // 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: RadarSignalGenerator203.cpp // // MATLAB Coder version : 5.3 // C/C++ source code generated on : 26-Apr-2023 23:54:03 // // Include Files #include "RadarSignalGenerator203.h" #include "PhaseCodedWaveform203.h" #include "../coder_array.h" #include #include #include // Function Definitions // // RADARSIGNALGENERATOR1 此处显示有关此函数的摘要 // 此处显示详细说明 // // Arguments : coder::array &sig // double *fs // double *PRF // double *len // Return Type : void // void RadarSignalGenerator203(coder::array &sig, double *fs, double *PRF, double *len) { static creal_T xt[40000]; static double b_xt[40000]; coder::phased::PhaseCodedWaveform203 wavGen; creal_T unusedExpr[10000]; double idx; int i; int ii; int loop_ub_tmp; // simTime = 2e-5; wavGen.isInitialized = 0; wavGen.matlabCodegenIsDeleted = false; // 连续调频波定义 // 产生5个脉冲 // numPulses = fix(simTime*PRF); *len = 0.0; for (ii = 0; ii < 5; ii++) { *len += 40000.0; } loop_ub_tmp = static_cast(*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.TunablePropsChanged = false; wavGen.pOutputPulseInterval[0] = 0.0; wavGen.pOutputPulseInterval[1] = 1.0; } std::memset(&xt[0], 0, 40000U * sizeof(creal_T)); coder::phased::PhaseCodedWaveform203::getMatchingWaveform(unusedExpr); std::copy(&unusedExpr[0], &unusedExpr[10000], &xt[0]); coder::phased::PhaseCodedWaveform203::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(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(idx) - 2; i1 = static_cast(static_cast(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 RadarSignalGenerator203.cpp // // [EOF] //