Create cossquare.cpp
This commit is contained in:
56
UTSR/Matlab_coder/cossquare.cpp
Normal file
56
UTSR/Matlab_coder/cossquare.cpp
Normal 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)
|
Reference in New Issue
Block a user