Exemplo n.º 1
0
static void update_covariance(
        const covariance_t * predicted_cov,
        const kalman_gain_t * gain,
        covariance_t * dest)
{
    matrix2d_t intermediate;
    // Adest = Asrc - K1*Asrc
    m_mult(&(gain->_k1), &(predicted_cov->_cov_a), &intermediate);
    m_diff(&(predicted_cov->_cov_a), &intermediate, &(dest->_cov_a));

    // Bdest = Bsrc - K1*Bsrc
    m_mult(&(gain->_k1), &(predicted_cov->_cov_b), &intermediate);
    m_diff(&(predicted_cov->_cov_b), &intermediate, &(dest->_cov_b));

    // Cdest = Csrc - K2*Asrc
    m_mult(&(gain->_k2), &(predicted_cov->_cov_a), &intermediate);
    m_diff(&(predicted_cov->_cov_c), &intermediate, &(dest->_cov_c));

    // Ddest = Dsrc - K2*Bsrc
    m_mult(&(gain->_k2), &(predicted_cov->_cov_b), &intermediate);
    m_diff(&(predicted_cov->_cov_d), &intermediate, &(dest->_cov_d));
}
Exemplo n.º 2
0
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////  THE MAIN  //////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void main()
{

  float *a;//Will contain pointer pointing to the resultant matrix
  int choice;

  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  ////////////////////////////////START OF MENU///////////////////////////////////////////////////////////////////
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  do
  {
    choice=menu();//variable recieves option number selected by the user

    switch(choice)
        {
          case 0:choice=0;
                 printf("\n\n\nTHANK YOU\n\n");
                 break;

          case 1:compatibility=1;
                 get_input(compatibility);//will input all data into global struct A and B
                 a=m_sum(X,Y);//ADDITION of struct matrix X,struct matrix Y
                 show_output(a);//will print the result in matrix A[][]
                 break;

          case 2:compatibility=1;
                 get_input(compatibility);//will input all data into global struct A and B
                 a=m_diff(X,Y);//Subraction of struct matrix X,struct matrix Y
                 show_output(a);//will print the result in matrix A[][]
                 break;


          case 3:compatibility=2;
                 get_input(compatibility);//will input all data into global struct A and B
                 a=m_prod(X,Y);//Product of struct matrix X,struct matrix Y
                 show_output(a);//will print the result in matrix A[][]
                 break;

          case 4:/*
                 compatibility=2;
                 get_input(compatibility);
                 a=m_div(X,Y);
                 show_output(a);
                 */
                 break;

          case 5:/*
                 compatibility=refer header comments;
                 get_input(compatibility);
                 a=m_funtion(input parameters);
                 show_output(a);
                 */
                 break;

         case 6:/*
                compatibility=refer header comments;
                get_input(compatibility);
                a=m_funtion(input parameters);
                show_output(a);
                */
                break;

        case 7:/*
               compatibility=refer header comments;
               get_input(compatibility);
               a=m_funtion(input parameters);
               show_output(a);
               */
               break;

       case 8:/*
              compatibility=refer header comments;
              get_input(compatibility);
              a=m_funtion(input parameters);
              show_output(a);
              */
              break;

      case 9:
             compatibility=3;
             get_input(compatibility);
             a=m_reshape(X,Y);
             show_output(a);

             break;

	case 10:
		      compatibility=0;
		      get_input(compatibility);
		      ans=m_det(X.arr,X.row_size*X.colm_size);
		      printf("The result of the determinant is %f",ans);
		      break;

        }


    }while(choice!=0);





}