From fb0179b756e227ac38494b56bacf9da646336a91 Mon Sep 17 00:00:00 2001 From: mathur04 <90455442+mathur04@users.noreply.github.com> Date: Wed, 10 Jul 2024 23:21:26 +0200 Subject: [PATCH] Create cossquare.cpp --- UTSR/Matlab_coder/cossquare.cpp | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 UTSR/Matlab_coder/cossquare.cpp diff --git a/UTSR/Matlab_coder/cossquare.cpp b/UTSR/Matlab_coder/cossquare.cpp new file mode 100644 index 0000000..aa18d21 --- /dev/null +++ b/UTSR/Matlab_coder/cossquare.cpp @@ -0,0 +1,56 @@ +// +// 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. +// +// cossquare.cpp +// +// Code generation for function 'cossquare' +// + +// Include files +#include "cossquare.h" +#include "rt_nonfinite.h" +#include + +// Function Definitions +void cossquare(const double f[4096], double fc, double BW, double r[4096]) +{ + double d; + double f4; + double f4_tmp; + // UNTITLED Summary of this function goes here + // Detailed explanation goes here + f4 = fc + BW; + d = 2.0 * fc; + f4_tmp = f4 - (fc - BW); + for (int k{0}; k < 4096; k++) { + double d1; + double d2; + double d3; + double d4; + boolean_T b; + boolean_T b1; + d1 = f[k]; + d2 = std::abs(d1); + b = (d2 <= f4); + b1 = ((d2 > fc) && b); + b = ((d2 <= fc) && b); + d3 = std::cos(3.1415926535897931 * (fc - static_cast(b1) * d2) / + f4_tmp); + d2 = 3.1415926535897931 * (fc - static_cast(b) * d2) / f4_tmp; + d2 = std::cos(d2); + if (std::isnan(d1)) { + d4 = rtNaN; + } else if (d1 < 0.0) { + d4 = -1.0; + } else { + d4 = (d1 > 0.0); + } + r[k] = static_cast(b1) * (d3 * d3) + + d4 * (static_cast(b) * + std::sin(3.1415926535897931 * d1 / d) * (d2 * d2)); + } +} + +// End of code generation (cossquare.cpp)