Show
Ignore:
Timestamp:
09/10/10 11:11:24 (14 years ago)
Author:
smidl
Message:

bug in sigma += Q(i) found

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/pmsm/simulator_zdenek/ekf_example/ekf_obj.cpp

    r1180 r1182  
    228228        const vec &u=cond; 
    229229        int dim = dimension(); 
    230          
     230        ///// !!!!!!!!!!!!!!!! 
    231231        U = est._R()._L().T(); 
    232232        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                 
    234246        //////////// 
    235247         
     
    246258        xref(3) = 3.141593; 
    247259        xref(4) = 34.0; 
     260         
     261        if (false){ 
     262                xref = ones(5); 
     263        } 
    248264         
    249265        imat Utf; 
     
    255271        mat_to_int(Utf,Uf);              
    256272        vec_to_int(Dtf, Df);  
     273 
     274//      cout << Dtf << endl; 
    257275         
    258276        // A*U == PSI*U 
     
    285303                        sigma2 += G(i,j)*G(i,j) * Q(j,j); 
    286304                }*/ 
    287                  
    288 /*              UDtof(U,D,Utf,Dtf,xref); 
     305                D(i) = sigma;  
     306                 
     307        /*      UDtof(U,D,Utf,Dtf,xref); 
    289308                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        */       
    294311                for (j=0;j<i;j++){  
    295312//                      cout << i << "," << j << endl; 
     
    316333                        } 
    317334                 
    318 /*                      cout << "end"<<endl; 
    319                         UDtof(U,D,Utf,Dtf,xref); 
    320                         cout << G << endl << Din << endl; 
    321                         cout << Utf << endl << Dtf << endl<<endl;*/ 
    322335                } 
     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; 
    323340        } 
    324341 
     
    328345        mat_to_int(Qrnd,Qf); 
    329346 
     347//      cout << Df <<endl; 
    330348        thorton(Uf,Df,PSIU,Qf,Gf,Dfold,5); 
    331349         
    332         cout << "bierman double I" <<endl; 
     350/*      cout << "bierman double I" <<endl; 
    333351        UDtof(U,D,Utf,Dtf,xref); 
    334352        cout << "Uf: " << Utf << endl; 
    335353        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;*/ 
    337355        mat_to_int(Utf,Uf);              
    338356        vec_to_int(Dtf, Df);  
     
    374392        } 
    375393 
    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; 
    380398 
    381399        int difz[2]; 
     
    387405        //beirman(int *difz, int *xp, int *U, int *D, int *R, unsigned int dimy, unsigned int dimx  
    388406         
    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; 
    395413 
    396414        int xf_old[5]; 
     
    399417         
    400418        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; 
    402420        for (i=0; i<5;i++) cout << Df[i] << ","; cout << endl; 
    403421        for (i=0; i<5;i++) cout << xf[i] << ","; cout << endl; 
    404         cout << endl; 
     422        cout << endl;*/ 
    405423         
    406424