Create cossquare.cpp

This commit is contained in:
mathur04
2024-07-10 23:21:26 +02:00
committed by GitHub
parent 3e84d6437e
commit fb0179b756

View File

@ -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 <cmath>
// 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<double>(b1) * d2) /
f4_tmp);
d2 = 3.1415926535897931 * (fc - static_cast<double>(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<double>(b1) * (d3 * d3) +
d4 * (static_cast<double>(b) *
std::sin(3.1415926535897931 * d1 / d) * (d2 * d2));
}
}
// End of code generation (cossquare.cpp)