#include "ekf_example/matrix_vs.h" #include "ekf_example/ekf_obj.h" int main(){ int i; mat A = 0.99*eye(5); A(0,3) = 0.06; A(0,2) = 0.01; A(1,2) = 0.01; A(1,3) = -0.07; A(3,2) = 0.0001; // RNG_randomize(); mat U=eye(5); for (int i=0; i<5;i++) { for (int j=i+1; j<5;j++) U(i,j)=2*randu(1)(0)-1; } mat Q = 0.1*diag(vec(" 0.2000 0.3000 0.4000 0.5000 0.6")); vec R = vec(" 0.2000 0.3000"); vec D = randu(5)*0.9; vec xref = ones(5); mat Ch = U*diag(sqrt(D)); int PSI[25]; int PSICh[25]={0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0}; int Chf[25]={0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0}; int Cf[10]={0,0,0,0,0, 0,0,0,0,0}; int multip=1<<15; /////////// COPY imat Af=round_i(A*multip); mat_to_int16(Af, PSI); mat_to_int16(round_i(Ch*multip),Chf); int Qf[25]; mat_to_int16(round_i(sqrt(Q)*multip), Qf); int Rf[2]; vec_to_int16(round_i(R*multip), Rf); ////////////// Test mmultAU mmultACh(PSI,Chf,PSICh,5,5); mat PhiCh =round(A*32768)*round(Ch*32768)/32768/32768; /* cout << "A*U" << round_i(PhiU*multip) <=0;i--){ sigma = 0.0; for (j=0; j