Changeset 1178 for applications/pmsm
- Timestamp:
- 09/02/10 14:40:58 (14 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/pmsm/simulator_zdenek/ekf_example/matrix_vs.cpp
r1174 r1178 152 152 for (j=0;j<dimx;j++){ 153 153 beta = alpha; 154 lambda = -((long)a[j]<<15)/beta; 154 155 alpha += ((long)(a[j])*b[j]>>15); 155 lambda = -(a[j])*gamma>>15; 156 gamma = (1<<15)/alpha; // in q15 now 157 int mpl=((long)beta*gamma); // no-shift, max_gamma=2^15 158 D[j] = (long)mpl*D[j]>>15; //gamma is long 156 D[j] = (((long)beta<<15)/alpha)*D[j]>>15; //gamma is long 159 157 if (D[j]==0) D[j]=1; 160 158 … … 166 164 } 167 165 } 168 int dzs = ( gamma*(difz[iy]))>>15; // apply scaling to innovations166 int dzs = (((long)difz[iy])<<15)/alpha; // apply scaling to innovations 169 167 // no shift due to gamma 170 168 for (i=0; i<dimx; i++){