File: arweights.c1 /* 2 * arweights.c 3 * 4 * Code generation for function 'arweights' 5 * 6 */ 7 8 /* Include files */ 9 #include "rt_nonfinite.h" 10 #include "gjbf.h" 11 #include "arweights.h" 12 #include "gjbf_data.h" 13 #include "blas.h" 14 15 /* Function Definitions */ 16 void arweights(const real_T rst[16], real_T ar[16]) 17 { 18 int32_T k; 19 real_T y; 20 covrtLogFcn(&emlrtCoverageInstance, 2U, 0); 21 covrtLogBasicBlock(&emlrtCoverageInstance, 2U, 0); 22 23 /* This function computes a set of weights for each sensor in an */ 24 /* array based on the distances from sources to the sensors. */ 25 /* */ 26 /* ar = arweights(rst) */ 27 /* */ 28 /* input: */ 29 /* RST vector of distances of each sensor to the point in space */ 30 /* output: */ 31 /* AR corresponding vector of weights for the array elements */ 32 /* */ 33 /* Written by Kevin D. Donohue August 2005 */ 34 /* */ 35 /* Find closest mic to point being considered */ 36 /* Create shading values to weight mic inputs as function of */ 37 /* distance giving closest mic the most weight. */ 38 for (k = 0; k < 16; k++) { 39 ar[k] = 1.0 / (rst[k] + 2.2204460492503131E-16); 40 } 41 42 y = ar[0]; 43 for (k = 0; k < 15; k++) { 44 y += ar[k + 1]; 45 } 46 47 for (k = 0; k < 16; k++) { 48 ar[k] /= y + 2.2204460492503131E-16; 49 } 50 } 51 52 /* End of code generation (arweights.c) */ 53 |