how to use Mat<cmat>

Help
Furqan
2013-08-28
2013-08-30
  • Furqan
    Furqan
    2013-08-28

    Dear all,I need your help.I want to make a mimo channel.I declare two variable

    Mat < cmat > mimo_chan;
    cmat chan;

    ...this is portion of code
    after creating channel chan i want to store it in mimo_chan but mimo_chan is causing segmentation fault.

    for (int i=0;i<3;i++)
    for (int j=0;j<3;j++)
    {
    mimo_chan(i,j) = channel_Model::chan;
    }

    How can i store vlaue in mimo_chan?
    Regards.

     
  • Bogdan Cristea
    Bogdan Cristea
    2013-08-28

    Hi
    There are several errors in the code above. First, the variable mimo_chan should be a matrix of complex values, thus it should be declared as

    cmat mimo_chan;

    Your declaration

    Mat < cmat > mimo_chan;

    means that mimo_chan is a matrix of cmat elements, i.e. in each element you store a complex matrix.

    Further, you need to specify the matrix size before initializing matrix elements:

    mimo_chan.set_size(3, 3);

    There is also a tutorial for MIMO channel simulation http://itpp.sourceforge.net/4.3.1/mimoconv.html

     
    • Furqan
      Furqan
      2013-08-30

      Thanskalot Respected Sir for reply and link.Dear sir is it posible matrix of cmat elements, i.e. in each element you store a complex matrix because i have to do it for one of my code.

      Regards
      furqan