- Timestamp:
- 09/10/10 11:11:24 (14 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/pmsm/simulator_zdenek/ekf_example/ekf_obj.cpp
r1180 r1182 228 228 const vec &u=cond; 229 229 int dim = dimension(); 230 230 ///// !!!!!!!!!!!!!!!! 231 231 U = est._R()._L().T(); 232 232 D = est._R()._D(); 233 233 if (false){ 234 mat L; 235 ivec tmp; 236 mat X=randn(5,5); 237 mat XX=X*X.T(); 238 mat T=diag(sqrt(1.0/diag(XX))); 239 XX= T*XX*T; 240 241 ldmat ldd(XX); 242 U = ldd._L().T(); 243 D = ldd._D()*0.9; 244 } 245 234 246 //////////// 235 247 … … 246 258 xref(3) = 3.141593; 247 259 xref(4) = 34.0; 260 261 if (false){ 262 xref = ones(5); 263 } 248 264 249 265 imat Utf; … … 255 271 mat_to_int(Utf,Uf); 256 272 vec_to_int(Dtf, Df); 273 274 // cout << Dtf << endl; 257 275 258 276 // A*U == PSI*U … … 285 303 sigma2 += G(i,j)*G(i,j) * Q(j,j); 286 304 }*/ 287 288 /* UDtof(U,D,Utf,Dtf,xref); 305 D(i) = sigma; 306 307 /* UDtof(U,D,Utf,Dtf,xref); 289 308 cout << "d=sig"<<endl; 290 cout << Utf << endl << Dtf << endl; 291 cout << G << endl << Din << endl<<endl;*/ 292 293 D(i) = sigma; 309 cout << Dtf << endl; 310 */ 294 311 for (j=0;j<i;j++){ 295 312 // cout << i << "," << j << endl; … … 316 333 } 317 334 318 /* cout << "end"<<endl;319 UDtof(U,D,Utf,Dtf,xref);320 cout << G << endl << Din << endl;321 cout << Utf << endl << Dtf << endl<<endl;*/322 335 } 336 UDtof(U,D,Utf,Dtf,xref); 337 // cout << G << endl << Din << endl; 338 imat Urw=Utf.T(); 339 cout << ivec(Urw._data(),25) << endl << Dtf << endl; 323 340 } 324 341 … … 328 345 mat_to_int(Qrnd,Qf); 329 346 347 // cout << Df <<endl; 330 348 thorton(Uf,Df,PSIU,Qf,Gf,Dfold,5); 331 349 332 cout << "bierman double I" <<endl;350 /* cout << "bierman double I" <<endl; 333 351 UDtof(U,D,Utf,Dtf,xref); 334 352 cout << "Uf: " << Utf << endl; 335 353 cout << "Df: " << Dtf << endl; 336 cout << "xf:" << round_i(elem_div(_mu,xref)*(1<<15)) <<endl; 354 cout << "xf:" << round_i(elem_div(_mu,xref)*(1<<15)) <<endl;*/ 337 355 mat_to_int(Utf,Uf); 338 356 vec_to_int(Dtf, Df); … … 374 392 } 375 393 376 UDtof(U,D,Utf,Dtf,xref);377 cout << "Uf: " << Utf << endl;378 cout << "Df: " << Dtf << endl;379 cout << "xf:" << round_i(elem_div(_mu,xref)*(1<<15)) <<endl;394 // UDtof(U,D,Utf,Dtf,xref); 395 // cout << "Uf: " << Utf << endl; 396 // cout << "Df: " << Dtf << endl; 397 // cout << "xf:" << round_i(elem_div(_mu,xref)*(1<<15)) <<endl; 380 398 381 399 int difz[2]; … … 387 405 //beirman(int *difz, int *xp, int *U, int *D, int *R, unsigned int dimy, unsigned int dimx 388 406 389 cout <<endl<< "bierman fixed" <<endl;390 for (i=0; i<25;i++) cout << Uf[i] << ","; cout <<endl;391 for (i=0; i<5;i++) cout << Df[i] << ","; cout << endl;392 for (i=0; i<5;i++) cout << xf[i] << ","; cout << endl;393 394 for (i=0; i<2;i++) cout << difz[i] << ","; cout << endl;407 // cout <<endl<< "bierman fixed" <<endl; 408 // for (i=0; i<25;i++) cout << Uf[i] << ","; cout <<endl; 409 // for (i=0; i<5;i++) cout << Df[i] << ","; cout << endl; 410 // for (i=0; i<5;i++) cout << xf[i] << ","; cout << endl; 411 // 412 // for (i=0; i<2;i++) cout << difz[i] << ","; cout << endl; 395 413 396 414 int xf_old[5]; … … 399 417 400 418 UDtof(U,D,Utf,Dtf,xref); 401 for (i=0; i<25;i++) cout << Uf[i] << ","; cout <<endl;419 /* for (i=0; i<25;i++) cout << Uf[i] << ","; cout <<endl; 402 420 for (i=0; i<5;i++) cout << Df[i] << ","; cout << endl; 403 421 for (i=0; i<5;i++) cout << xf[i] << ","; cout << endl; 404 cout << endl; 422 cout << endl;*/ 405 423 406 424