File: D:\TMTmethod\simulator\codegen\mex\testspline\testspline.c1 /* 2 * testspline.c 3 * 4 * Code generation for function 'testspline' 5 * 6 * C source code generated on: Thu Aug 30 14:03:55 2012 7 * 8 */ 9 10 /* Include files */ 11 #include "rt_nonfinite.h" 12 #include "testspline.h" 13 #include "EvalSpline.h" 14 #include "testspline_mexutil.h" 15 16 /* Type Definitions */ 17 18 /* Named Constants */ 19 20 /* Variable Declarations */ 21 22 /* Variable Definitions */ 23 static emlrtRSInfo emlrtRSI = { 13, "testspline", "D:/TMTmethod/simulator/dummy/testspline.m" }; 24 static emlrtRSInfo b_emlrtRSI = { 19, "testspline", "D:/TMTmethod/simulator/dummy/testspline.m" }; 25 static emlrtRSInfo c_emlrtRSI = { 20, "testspline", "D:/TMTmethod/simulator/dummy/testspline.m" }; 26 static emlrtRSInfo d_emlrtRSI = { 16, "CubicSplineTrajectory_single", "D:/TMTmethod/simulator/splines/CubicSplineTrajectory_single.m" }; 27 static emlrtRSInfo f_emlrtRSI = { 17, "sum", "C:/Program Files/MATLAB/R2011b/toolbox/eml/lib/matlab/datafun/sum.m" }; 28 static emlrtMCInfo emlrtMCI = { 18, 9, "sum", "C:/Program Files/MATLAB/R2011b/toolbox/eml/lib/matlab/datafun/sum.m" }; 29 static emlrtMCInfo b_emlrtMCI = { 17, 19, "sum", "C:/Program Files/MATLAB/R2011b/toolbox/eml/lib/matlab/datafun/sum.m" }; 30 static emlrtBCInfo emlrtBCI = { 1, 2, 16, 43, "duration", "CubicSplineTrajectory_single", "D:/TMTmethod/simulator/splines/CubicSplineTrajectory_single.m", 0 }; 31 32 /* Function Declarations */ 33 34 /* Function Definitions */ 35 36 void testspline(void) 37 { 38 real_T spliney_startTime[2]; 39 real_T spliney_duration[2]; 40 int32_T i; 41 real_T spliney_coefs[8]; 42 int32_T k; 43 int8_T x_sizes[2]; 44 boolean_T p; 45 boolean_T b_p; 46 int32_T exitg1; 47 const mxArray *y; 48 static const int32_T iv0[2] = { 1, 30 }; 49 const mxArray *m0; 50 static const char_T cv0[30] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o', 'l', 'b', 'o', 'x', ':', 's', 'u', 'm', '_', 's', 'p', 'e', 'c', 'i', 'a', 'l', 'E', 'm', 'p', 't', 'y' }; 51 real_T b_y; 52 real_T dv0[2]; 53 real_T dv1[2]; 54 static const real_T x[6] = { 0.1, 0.2, 0.0, 0.0, 0.0, 0.0 }; 55 real_T x_start[2]; 56 real_T x_end[2]; 57 real_T coefs[4]; 58 real_T unusedExpr[3]; 59 static const real_T dv2[101] = { 0.0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31, 0.32, 0.33, 0.34, 0.35000000000000003, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41000000000000003, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47000000000000003, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57000000000000006, 0.58000000000000007, 0.59, 0.6, 0.61, 0.62, 0.63, 0.64, 0.64999999999999991, 0.65999999999999992, 0.66999999999999993, 0.67999999999999994, 0.69, 0.7, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.8, 0.81, 0.82000000000000006, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.9, 0.91, 0.92, 0.92999999999999994, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.0 }; 60 real_T b_unusedExpr[3]; 61 /* TESTPLINE Summary of this function goes here */ 62 /* Detailed explanation goes here */ 63 /* d = load('20081912999MarkerPositionsMov.mat'); */ 64 /* subplot 211; plot(squeeze(d.data.DataValues(:,15,69:end))'); */ 65 EMLRTPUSHRTSTACK(&emlrtRSI); 66 /* spline = CubicSplineTrajectory(startTime,duration,x) with */ 67 /* startTime = [1x1] */ 68 /* duration = [Nx1] */ 69 /* x = [(N+1)x2] */ 70 /* returns a (N+1)-knots spline */ 71 for (i = 0; i < 2; i++) { 72 spliney_startTime[i] = 0.0; 73 spliney_duration[i] = 0.2 + 0.60000000000000009 * (real_T)i; 74 } 75 memset((void *)&spliney_coefs[0], 0, sizeof(real_T) << 3); 76 for (i = 0; i < 2; i++) { 77 if (1 > i) { 78 k = -1; 79 } else { 80 emlrtBoundsCheck(1, &emlrtBCI); 81 k = 0; 82 } 83 EMLRTPUSHRTSTACK(&d_emlrtRSI); 84 x_sizes[0] = 1; 85 x_sizes[1] = (int8_T)(k + 1); 86 p = FALSE; 87 b_p = FALSE; 88 k = 0; 89 do { 90 exitg1 = 0U; 91 if (k < 2) { 92 if (x_sizes[k] != 0) { 93 exitg1 = 1U; 94 } else { 95 k++; 96 } 97 } else { 98 b_p = TRUE; 99 exitg1 = 1U; 100 } 101 } while (exitg1 == 0U); 102 if (b_p) { 103 b_p = TRUE; 104 } else { 105 b_p = FALSE; 106 } 107 if (!b_p) { 108 } else { 109 p = TRUE; 110 } 111 if (!p) { 112 p = TRUE; 113 } else { 114 p = FALSE; 115 } 116 if (p) { 117 } else { 118 EMLRTPUSHRTSTACK(&f_emlrtRSI); 119 y = NULL; 120 m0 = mxCreateCharArray(2, iv0); 121 emlrtInitCharArray(30, m0, cv0); 122 emlrtAssign(&y, m0); 123 error(message(y, &emlrtMCI), &b_emlrtMCI); 124 EMLRTPOPRTSTACK(&f_emlrtRSI); 125 } 126 if (x_sizes[1] == 0) { 127 b_y = 0.0; 128 } else { 129 b_y = 0.2; 130 } 131 spliney_startTime[i] = b_y; 132 EMLRTPOPRTSTACK(&d_emlrtRSI); 133 dv0[0] = 1.0; 134 dv0[1] = 0.2 + 0.60000000000000009 * (real_T)i; 135 dv1[0] = 1.0; 136 dv1[1] = 0.2 + 0.60000000000000009 * (real_T)i; 137 for (k = 0; k < 2; k++) { 138 x_start[k] = x[i + 3 * k] * dv0[k]; 139 x_end[k] = x[(i + 3 * k) + 1] * dv1[k]; 140 } 141 for (k = 0; k < 4; k++) { 142 coefs[k] = 0.0; 143 } 144 coefs[0] = x_start[0]; 145 coefs[1] = x_start[1]; 146 coefs[2] = ((-3.0 * x_start[0] - 2.0 * x_start[1]) + 3.0 * x_end[0]) - x_end[1]; 147 coefs[3] = ((2.0 * x_start[0] + x_start[1]) - 2.0 * x_end[0]) + x_end[1]; 148 for (k = 0; k < 4; k++) { 149 spliney_coefs[i + (k << 1)] = coefs[k]; 150 } 151 emlrtBreakCheck(); 152 } 153 EMLRTPOPRTSTACK(&emlrtRSI); 154 for (i = 0; i < 101; i++) { 155 EMLRTPUSHRTSTACK(&b_emlrtRSI); 156 EvalSpline(dv2[i], unusedExpr); 157 EMLRTPOPRTSTACK(&b_emlrtRSI); 158 EMLRTPUSHRTSTACK(&c_emlrtRSI); 159 b_EvalSpline(dv2[i], spliney_startTime, spliney_duration, spliney_coefs, b_unusedExpr); 160 EMLRTPOPRTSTACK(&c_emlrtRSI); 161 emlrtBreakCheck(); 162 } 163 /* subplot 212; hold on; */ 164 /* plot(t,x(:,1)) */ 165 /* plot(t,y(:,1),'g') */ 166 } 167 /* End of code generation (testspline.c) */ 168 |