File: ccafbounds.c1 /* 2 * ccafbounds.c 3 * 4 * Code generation for function 'ccafbounds' 5 * 6 */ 7 8 /* Include files */ 9 #include "rt_nonfinite.h" 10 #include "ccafbounds.h" 11 #include "ccafbounds_emxutil.h" 12 #include "error1.h" 13 #include "eml_int_forloop_overflow_check.h" 14 #include "ccafbounds_data.h" 15 16 /* Variable Definitions */ 17 static emlrtRSInfo emlrtRSI = { 45, "ccafbounds", 18 "E:\\micro array project\\Microphone Array\\beamform test\\ccafbounds.m" }; 19 20 static emlrtRSInfo b_emlrtRSI = { 46, "ccafbounds", 21 "E:\\micro array project\\Microphone Array\\beamform test\\ccafbounds.m" }; 22 23 static emlrtRSInfo c_emlrtRSI = { 49, "ccafbounds", 24 "E:\\micro array project\\Microphone Array\\beamform test\\ccafbounds.m" }; 25 26 static emlrtRSInfo d_emlrtRSI = { 51, "ccafbounds", 27 "E:\\micro array project\\Microphone Array\\beamform test\\ccafbounds.m" }; 28 29 static emlrtRSInfo e_emlrtRSI = { 54, "ccafbounds", 30 "E:\\micro array project\\Microphone Array\\beamform test\\ccafbounds.m" }; 31 32 static emlrtRSInfo f_emlrtRSI = { 57, "ccafbounds", 33 "E:\\micro array project\\Microphone Array\\beamform test\\ccafbounds.m" }; 34 35 static emlrtRSInfo g_emlrtRSI = { 79, "ccafbounds", 36 "E:\\micro array project\\Microphone Array\\beamform test\\ccafbounds.m" }; 37 38 static emlrtRSInfo h_emlrtRSI = { 12, "all", 39 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\ops\\all.m" }; 40 41 static emlrtRSInfo i_emlrtRSI = { 124, "allOrAny", 42 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\eml\\+coder\\+internal\\allOrAny.m" 43 }; 44 45 static emlrtRSInfo j_emlrtRSI = { 20, "eml_int_forloop_overflow_check", 46 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\eml\\eml_int_forloop_overflow_check.m" 47 }; 48 49 static emlrtRSInfo k_emlrtRSI = { 49, "power", 50 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\ops\\power.m" }; 51 52 static emlrtRSInfo l_emlrtRSI = { 12, "sqrt", 53 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\elfun\\sqrt.m" 54 }; 55 56 static emlrtMCInfo emlrtMCI = { 27, 5, "error", 57 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\lang\\error.m" 58 }; 59 60 static emlrtRTEInfo emlrtRTEI = { 41, 23, "ccafbounds", 61 "E:\\micro array project\\Microphone Array\\beamform test\\ccafbounds.m" }; 62 63 static emlrtRTEInfo c_emlrtRTEI = { 82, 5, "ccafbounds", 64 "E:\\micro array project\\Microphone Array\\beamform test\\ccafbounds.m" }; 65 66 static emlrtDCInfo emlrtDCI = { 74, 13, "ccafbounds", 67 "E:\\micro array project\\Microphone Array\\beamform test\\ccafbounds.m", 1 }; 68 69 static emlrtDCInfo b_emlrtDCI = { 74, 13, "ccafbounds", 70 "E:\\micro array project\\Microphone Array\\beamform test\\ccafbounds.m", 4 }; 71 72 static emlrtBCInfo emlrtBCI = { -1, -1, 83, 13, "phi", "ccafbounds", 73 "E:\\micro array project\\Microphone Array\\beamform test\\ccafbounds.m", 0 }; 74 75 static emlrtRSInfo m_emlrtRSI = { 27, "error", 76 "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\lang\\error.m" 77 }; 78 79 /* Function Declarations */ 80 static void b_error(const emlrtStack *sp, const mxArray *b, emlrtMCInfo 81 *location); 82 83 /* Function Definitions */ 84 static void b_error(const emlrtStack *sp, const mxArray *b, emlrtMCInfo 85 *location) 86 { 87 const mxArray *pArray; 88 pArray = b; 89 emlrtCallMATLABR2012b(sp, 0, NULL, 1, &pArray, "error", true, location); 90 } 91 92 void ccafbounds(const emlrtStack *sp, const real_T mpos[48], real_T fs, real_T 93 soundc, real_T prop, real_T order, emxArray_real_T *phi, 94 emxArray_real_T *psi) 95 { 96 boolean_T b[48]; 97 boolean_T b_b[48]; 98 int32_T i2; 99 boolean_T y[16]; 100 int32_T iy; 101 int32_T i; 102 int32_T i1; 103 boolean_T b_y; 104 boolean_T exitg1; 105 boolean_T exitg2; 106 boolean_T guard1 = false; 107 const mxArray *c_y; 108 char_T u[38]; 109 static const char_T varargin_1[38] = { 'm', 'p', 'o', 's', ' ', 'm', 'u', 's', 110 't', ' ', 'b', 'e', ' ', 'a', ' ', 'r', 'e', 'a', 'l', ' ', 'm', 'a', 't', 111 'r', 'i', 'x', ' ', 'w', 'i', 't', 'h', ' ', '3', ' ', 'r', 'o', 'w', 's' }; 112 113 boolean_T guard2 = false; 114 const mxArray *m0; 115 static const int32_T iv0[2] = { 1, 38 }; 116 117 boolean_T guard3 = false; 118 real_T s; 119 real_T r; 120 const mxArray *d_y; 121 char_T b_u[29]; 122 static const char_T b_varargin_1[29] = { 'f', 's', ' ', 'm', 'u', 's', 't', 123 ' ', 'b', 'e', ' ', 'a', ' ', 'p', 'o', 's', 'i', 't', 'i', 'v', 'e', ' ', 124 'i', 'n', 't', 'e', 'g', 'e', 'r' }; 125 126 static const int32_T iv1[2] = { 1, 29 }; 127 128 const mxArray *e_y; 129 char_T c_u[31]; 130 static const char_T c_varargin_1[31] = { 'p', 'r', 'o', 'p', ' ', 'm', 'u', 131 's', 't', ' ', 'b', 'e', ' ', 'a', ' ', 'p', 'o', 's', 'i', 't', 'i', 'v', 132 'e', ' ', 'i', 'n', 't', 'e', 'g', 'e', 'r' }; 133 134 static const int32_T iv2[2] = { 1, 31 }; 135 136 const mxArray *f_y; 137 char_T d_u[32]; 138 static const char_T d_varargin_1[32] = { 'o', 'r', 'd', 'e', 'r', ' ', 'm', 139 'u', 's', 't', ' ', 'b', 'e', ' ', 'a', ' ', 'p', 'o', 's', 'i', 't', 'i', 140 'v', 'e', ' ', 'i', 'n', 't', 'e', 'g', 'e', 'r' }; 141 142 static const int32_T iv3[2] = { 1, 32 }; 143 144 const mxArray *g_y; 145 char_T e_u[35]; 146 static const char_T e_varargin_1[35] = { 's', 'o', 'u', 'n', 'd', 'c', ' ', 147 'm', 'u', 's', 't', ' ', 'b', 'e', ' ', 'p', 'o', 's', 'i', 't', 'i', 'v', 148 'e', ' ', 'r', 'e', 'a', 'l', ' ', 's', 'c', 'a', 'l', 'a', 'r' }; 149 150 static const int32_T iv4[2] = { 1, 35 }; 151 152 int32_T mIter; 153 real_T h_y[3]; 154 real_T i_y[3]; 155 real_T Tm; 156 int32_T nIter; 157 real_T f_varargin_1[3]; 158 emlrtStack st; 159 emlrtStack b_st; 160 emlrtStack c_st; 161 emlrtStack d_st; 162 st.prev = sp; 163 st.tls = sp->tls; 164 b_st.prev = &st; 165 b_st.tls = st.tls; 166 c_st.prev = &b_st; 167 c_st.tls = b_st.tls; 168 d_st.prev = &c_st; 169 d_st.tls = c_st.tls; 170 covrtLogFcn(&emlrtCoverageInstance, 0U, 0); 171 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 0); 172 173 /* % CCAF Bound Calculator */ 174 /* This function calculates the constant upper and lower matrices phi */ 175 /* and psi for CCAF's for the Blocking Matrix (BM) */ 176 /* */ 177 /* *Syntax* */ 178 /* |[phi, psi] = ccafbounds(m, fs, c, p, order)| */ 179 /* *Inputs* */ 180 /* *|mpos|-microphone positions in R^3 (meters) */ 181 /* *|fs|-sample rate (Hertz) */ 182 /* *|soundc|-Speed of sound (meters/sec) */ 183 /* *|prop|-Estimated propagation time across the array in samples */ 184 /* *|order|-Order of the adaptive filters */ 185 /* */ 186 /* *Outputs* */ 187 /* * |phi| - Matrix of upper bounds, where each column is a vector of */ 188 /* bounds for a the adaptive filter of a single track in the BM. */ 189 /* * |psi| - Matrix of lower bounds with the same structure as psi. */ 190 /* */ 191 /* *Notes* */ 192 /* */ 193 /* This code is based on equations derived for a linear microphone */ 194 /* array where the effect of the coefficient bounds */ 195 /* would be to expand the main lobe of the beamformer depending on the */ 196 /* sine of a parameter delta-theta, the supposed error in steering */ 197 /* angle of the beamformer. However, here we consider a beamformer of */ 198 /* arbitary geometry and thus the parameter "delta-theta" no longer */ 199 /* makes sense. Our current adaptation of the algorithm is */ 200 /* */ 201 /* # Consider the center of the array as the centroid of array, */ 202 /* calculated as the arithmetic mean of the mic coordinates. */ 203 /* # Hard-code a value for sin(delta-theta), which we know must be */ 204 /* bounded [-1 1]. At present we've selected .05 */ 205 /* */ 206 /* Note that these adaptations will still recreate the original */ 207 /* performance of the algorithm for a linear array, where our selection */ 208 /* of .05 for sin(delta-theta) corresponds to a steering angle error of */ 209 /* about +/- 3 degrees. */ 210 /* % Function Declaration */ 211 /* % Argument Error Checking */ 212 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 0, true); 213 for (i2 = 0; i2 < 48; i2++) { 214 b[i2] = muDoubleScalarIsInf(mpos[i2]); 215 b_b[i2] = muDoubleScalarIsNaN(mpos[i2]); 216 } 217 218 st.site = &emlrtRSI; 219 b_st.site = &h_emlrtRSI; 220 for (i2 = 0; i2 < 16; i2++) { 221 y[i2] = true; 222 } 223 224 i2 = 0; 225 iy = -1; 226 for (i = 0; i < 16; i++) { 227 i1 = i2 + 1; 228 i2 += 3; 229 iy++; 230 c_st.site = &i_emlrtRSI; 231 if ((!(i1 > i2)) && (i2 > 2147483646)) { 232 d_st.site = &j_emlrtRSI; 233 check_forloop_overflow_error(&d_st); 234 } 235 236 i1--; 237 exitg2 = false; 238 while ((!exitg2) && (i1 + 1 <= i2)) { 239 if (!((!b[i1]) && (!b_b[i1]))) { 240 y[iy] = false; 241 exitg2 = true; 242 } else { 243 i1++; 244 } 245 } 246 } 247 248 b_y = true; 249 i1 = 0; 250 exitg1 = false; 251 while ((!exitg1) && (i1 < 16)) { 252 if (!y[i1]) { 253 b_y = false; 254 exitg1 = true; 255 } else { 256 i1++; 257 } 258 } 259 260 if (!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 1, b_y)) { 261 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 0, true); 262 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 0, true); 263 st.site = &b_emlrtRSI; 264 for (i2 = 0; i2 < 38; i2++) { 265 u[i2] = varargin_1[i2]; 266 } 267 268 c_y = NULL; 269 m0 = emlrtCreateCharArray(2, iv0); 270 emlrtInitCharArrayR2013a(&st, 38, m0, &u[0]); 271 emlrtAssign(&c_y, m0); 272 b_st.site = &m_emlrtRSI; 273 b_error(&b_st, c_y, &emlrtMCI); 274 } else { 275 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 2, false); 276 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 0, false); 277 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 0, false); 278 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 3, true); 279 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 4, true); 280 guard1 = false; 281 guard2 = false; 282 guard3 = false; 283 if ((!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 5, (!muDoubleScalarIsInf 284 (fs)) && (!muDoubleScalarIsNaN(fs)))) || covrtLogCond 285 (&emlrtCoverageInstance, 0U, 0U, 6, fs < 0.0)) { 286 guard3 = true; 287 } else { 288 s = muDoubleScalarFloor(fs); 289 if (s == 0.0) { 290 r = fs; 291 } else if (s == s) { 292 r = fs - muDoubleScalarFloor(fs / s) * s; 293 } else { 294 r = fs / s; 295 if (muDoubleScalarAbs(r - muDoubleScalarRound(r)) <= 296 2.2204460492503131E-16 * r) { 297 r = 0.0; 298 } else { 299 r = (r - muDoubleScalarFloor(r)) * s; 300 } 301 } 302 303 if (covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 7, muDoubleScalarAbs(r) > 304 0.0)) { 305 guard3 = true; 306 } else { 307 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 1, false); 308 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 1, false); 309 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 8, true); 310 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 9, true); 311 if ((!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 10, 312 (!muDoubleScalarIsInf(soundc)) && 313 (!muDoubleScalarIsNaN(soundc)))) || covrtLogCond 314 (&emlrtCoverageInstance, 0U, 0U, 11, soundc <= 0.0)) { 315 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 2, true); 316 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 2, true); 317 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 1); 318 st.site = &d_emlrtRSI; 319 for (i2 = 0; i2 < 35; i2++) { 320 e_u[i2] = e_varargin_1[i2]; 321 } 322 323 g_y = NULL; 324 m0 = emlrtCreateCharArray(2, iv4); 325 emlrtInitCharArrayR2013a(&st, 35, m0, &e_u[0]); 326 emlrtAssign(&g_y, m0); 327 b_st.site = &m_emlrtRSI; 328 b_error(&b_st, g_y, &emlrtMCI); 329 } else { 330 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 2, false); 331 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 2, false); 332 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 12, true); 333 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 13, true); 334 if ((!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 14, 335 (!muDoubleScalarIsInf(prop)) && 336 (!muDoubleScalarIsNaN(prop)))) || covrtLogCond 337 (&emlrtCoverageInstance, 0U, 0U, 15, prop < 0.0)) { 338 guard2 = true; 339 } else { 340 s = muDoubleScalarFloor(prop); 341 if (s == 0.0) { 342 r = prop; 343 } else if (s == s) { 344 r = prop - muDoubleScalarFloor(prop / s) * s; 345 } else { 346 r = prop / s; 347 if (muDoubleScalarAbs(r - muDoubleScalarRound(r)) <= 348 2.2204460492503131E-16 * r) { 349 r = 0.0; 350 } else { 351 r = (r - muDoubleScalarFloor(r)) * s; 352 } 353 } 354 355 if (covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 16, 356 muDoubleScalarAbs(r) > 0.0)) { 357 guard2 = true; 358 } else { 359 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 3, false); 360 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 3, false); 361 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 17, true); 362 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 18, true); 363 if ((!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 19, 364 (!muDoubleScalarIsInf(order)) && 365 (!muDoubleScalarIsNaN(order)))) || covrtLogCond 366 (&emlrtCoverageInstance, 0U, 0U, 20, order < 0.0)) { 367 guard1 = true; 368 } else { 369 s = muDoubleScalarFloor(order); 370 if (s == 0.0) { 371 r = order; 372 } else if (s == s) { 373 r = order - muDoubleScalarFloor(order / s) * s; 374 } else { 375 r = order / s; 376 if (muDoubleScalarAbs(r - muDoubleScalarRound(r)) <= 377 2.2204460492503131E-16 * r) { 378 r = 0.0; 379 } else { 380 r = (r - muDoubleScalarFloor(r)) * s; 381 } 382 } 383 384 if (covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 21, 385 muDoubleScalarAbs(r) > 0.0)) { 386 guard1 = true; 387 } else { 388 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 4, false); 389 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 4, false); 390 } 391 } 392 } 393 } 394 } 395 } 396 } 397 398 if (guard3) { 399 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 1, true); 400 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 1, true); 401 st.site = &c_emlrtRSI; 402 for (i2 = 0; i2 < 29; i2++) { 403 b_u[i2] = b_varargin_1[i2]; 404 } 405 406 d_y = NULL; 407 m0 = emlrtCreateCharArray(2, iv1); 408 emlrtInitCharArrayR2013a(&st, 29, m0, &b_u[0]); 409 emlrtAssign(&d_y, m0); 410 b_st.site = &m_emlrtRSI; 411 b_error(&b_st, d_y, &emlrtMCI); 412 } 413 414 if (guard2) { 415 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 3, true); 416 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 3, true); 417 st.site = &e_emlrtRSI; 418 for (i2 = 0; i2 < 31; i2++) { 419 c_u[i2] = c_varargin_1[i2]; 420 } 421 422 e_y = NULL; 423 m0 = emlrtCreateCharArray(2, iv2); 424 emlrtInitCharArrayR2013a(&st, 31, m0, &c_u[0]); 425 emlrtAssign(&e_y, m0); 426 b_st.site = &m_emlrtRSI; 427 b_error(&b_st, e_y, &emlrtMCI); 428 } 429 430 if (guard1) { 431 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 4, true); 432 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 4, true); 433 st.site = &f_emlrtRSI; 434 for (i2 = 0; i2 < 32; i2++) { 435 d_u[i2] = d_varargin_1[i2]; 436 } 437 438 f_y = NULL; 439 m0 = emlrtCreateCharArray(2, iv3); 440 emlrtInitCharArrayR2013a(&st, 32, m0, &d_u[0]); 441 emlrtAssign(&f_y, m0); 442 b_st.site = &m_emlrtRSI; 443 b_error(&b_st, f_y, &emlrtMCI); 444 } 445 } 446 447 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 2); 448 449 /* % Calculate Bounds */ 450 /* In the original paper, the bound vectors for each adaptive filter are */ 451 /* calculated as */ 452 /* */ 453 /* $$\phi_{m,n} = \frac{1}{\pi\ max(.1, \ */ 454 /* (n\ ^\_ \ P)\ ^\_ \ T_m, \ ^\_ (n\ ^\_ \ P)\ ^\_ \ T_m)} \quad */ 455 /* \psi = \ ^\_ \phi\ \forall\ m, n$$ */ 456 /* */ 457 /* $$T_m = \frac{b_mf_s}{c}\sin\Delta\theta $$ */ 458 /* */ 459 /* where bm is the distance of the mth microphone to the center of the */ 460 /* array. Remember that we must fudge for sin(delta-theta) in R^3. */ 461 /* number of microphones in the array */ 462 i2 = phi->size[0] * phi->size[1]; 463 if (!(order >= 0.0)) { 464 emlrtNonNegativeCheckR2012b(order, &b_emlrtDCI, sp); 465 } 466 467 s = order; 468 if (s != (int32_T)muDoubleScalarFloor(s)) { 469 emlrtIntegerCheckR2012b(s, &emlrtDCI, sp); 470 } 471 472 phi->size[0] = (int32_T)s; 473 phi->size[1] = 16; 474 emxEnsureCapacity(sp, (emxArray__common *)phi, i2, (int32_T)sizeof(real_T), 475 &emlrtRTEI); 476 if (!(order >= 0.0)) { 477 emlrtNonNegativeCheckR2012b(order, &b_emlrtDCI, sp); 478 } 479 480 if (s != (int32_T)muDoubleScalarFloor(s)) { 481 emlrtIntegerCheckR2012b(s, &emlrtDCI, sp); 482 } 483 484 i1 = (int32_T)s << 4; 485 for (i2 = 0; i2 < i1; i2++) { 486 phi->data[i2] = 0.0; 487 } 488 489 /* initialze upper bound matrix for iteration */ 490 mIter = 0; 491 while (mIter < 16) { 492 covrtLogFor(&emlrtCoverageInstance, 0U, 0U, 0, 1); 493 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 3); 494 495 /* iterate over all microphones */ 496 /* kludge for 3-D (see Notes section above) */ 497 for (i2 = 0; i2 < 3; i2++) { 498 s = mpos[i2]; 499 for (i1 = 0; i1 < 15; i1++) { 500 s += mpos[i2 + (i1 + 1) * 3]; 501 } 502 503 h_y[i2] = s; 504 } 505 506 /* use centroid as "center" of array */ 507 st.site = &g_emlrtRSI; 508 for (i2 = 0; i2 < 3; i2++) { 509 h_y[i2] = mpos[i2 + 3 * mIter] - h_y[i2] / 16.0; 510 } 511 512 b_st.site = &k_emlrtRSI; 513 for (i1 = 0; i1 < 3; i1++) { 514 i_y[i1] = h_y[i1] * h_y[i1]; 515 } 516 517 s = i_y[0]; 518 for (i1 = 0; i1 < 2; i1++) { 519 s += i_y[i1 + 1]; 520 } 521 522 st.site = &g_emlrtRSI; 523 if (s < 0.0) { 524 b_st.site = &l_emlrtRSI; 525 error(&b_st); 526 } 527 528 /* Get mic distance */ 529 /* from centroid */ 530 Tm = muDoubleScalarSqrt(s) * fs * 0.05 / soundc; 531 532 /* Hoshuyama equation */ 533 emlrtForLoopVectorCheckR2012b(1.0, 1.0, order, mxDOUBLE_CLASS, (int32_T) 534 order, &c_emlrtRTEI, sp); 535 nIter = 0; 536 while (nIter <= (int32_T)order - 1) { 537 covrtLogFor(&emlrtCoverageInstance, 0U, 0U, 1, 1); 538 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 4); 539 540 /* Set bound for each tap of this adaptive filter */ 541 f_varargin_1[0] = 0.1; 542 f_varargin_1[1] = ((1.0 + (real_T)nIter) - prop) - Tm; 543 f_varargin_1[2] = -((1.0 + (real_T)nIter) - prop) - Tm; 544 s = 0.1; 545 for (i1 = 0; i1 < 2; i1++) { 546 if (f_varargin_1[i1 + 1] > s) { 547 s = f_varargin_1[i1 + 1]; 548 } 549 } 550 551 i2 = phi->size[0]; 552 if (!((nIter + 1 >= 1) && (nIter + 1 <= i2))) { 553 emlrtDynamicBoundsCheckR2012b(nIter + 1, 1, i2, &emlrtBCI, sp); 554 } 555 556 phi->data[nIter + phi->size[0] * mIter] = 1.0 / (3.1415926535897931 * s); 557 558 /* directly from Hoshuyama paper */ 559 nIter++; 560 if (*emlrtBreakCheckR2012bFlagVar != 0) { 561 emlrtBreakCheckR2012b(sp); 562 } 563 } 564 565 covrtLogFor(&emlrtCoverageInstance, 0U, 0U, 1, 0); 566 mIter++; 567 if (*emlrtBreakCheckR2012bFlagVar != 0) { 568 emlrtBreakCheckR2012b(sp); 569 } 570 } 571 572 covrtLogFor(&emlrtCoverageInstance, 0U, 0U, 0, 0); 573 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 5); 574 i2 = psi->size[0] * psi->size[1]; 575 psi->size[0] = phi->size[0]; 576 psi->size[1] = 16; 577 emxEnsureCapacity(sp, (emxArray__common *)psi, i2, (int32_T)sizeof(real_T), 578 &emlrtRTEI); 579 i1 = phi->size[0] * phi->size[1]; 580 for (i2 = 0; i2 < i1; i2++) { 581 psi->data[i2] = -phi->data[i2]; 582 } 583 584 /* psi is simply the opposite of phi */ 585 } 586 587 /* End of code generation (ccafbounds.c) */ 588 |