title: Matlab Matrixes in C++
body: <p>I'm a newbie programmer trying to translate MATLAB code into C++ for embedded systems. My question is: Can I write in a more elegant way these particular matrixes in order to multiply them afterwards? Should I use vectors instead? (I'm not very familiar with their syntax).</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  
  using namespace std; 
  
  int main() {
  
      double matrixF [10][6] = {0.0};
      double freq {0.01};
      for(size_t i{0};i&lt;10;++i){
              for(size_t j{0}; j&lt;6;j++){
                  if(j == 0) 
                      matrixF[i][j] = cos(2*M_PI*freq*i);  
                  else if(j == 1) 
                      matrixF[i][j] = sin(2*M_PI*freq*i);
                  else if(j == 2) 
                      matrixF[i][j] = cos(4*M_PI*freq*i);
                  else if(j == 3) 
                     matrixF[i][j] = sin(4*M_PI*freq*i); 
                  else if(j == 4) 
                     matrixF[i][j] = cos(6*M_PI*freq*i); 
                  else if(j == 5)
                     matrixF[i][j] = sin(6*M_PI*freq*i); 
                  }
      }      
  
      cout &lt;&lt; "Displaying the matrix: " &lt;&lt; endl;
      for (size_t i{0}; i&lt;10;++i){
          for (size_t j{0}; j&lt;6; ++j) {
              cout &lt;&lt; matrixF[i][j] &lt;&lt; " ";
          }
              cout &lt;&lt; endl;
      }
  
  
      double matrixT [6][10] = {0.0};
          for (size_t i{0}; i&lt;6; i++){
              for(size_t j{0}; j&lt;10; j++){
                   if(i == 0) 
                      matrixT[i][j] = cos(2*M_PI*freq*j);  
                  else if(i == 1) 
                      matrixT[i][j] = sin(2*M_PI*freq*j);
                  else if(i == 2) 
                      matrixT[i][j] = cos(4*M_PI*freq*j);
                  else if(i == 3) 
                     matrixT[i][j] = sin(4*M_PI*freq*j); 
                  else if(i == 4) 
                     matrixT[i][j] = cos(6*M_PI*freq*j); 
                  else if(i == 5)
                     matrixT[i][j] = sin(6*M_PI*freq*j); 
                  }
      }
  
      cout &lt;&lt; "Displaying the transpose Matrix: " &lt;&lt; endl;
      for (size_t i{0}; i&lt;6;++i){
          for (size_t j{0}; j&lt;10; ++j) {
              cout &lt;&lt; matrixT[i][j] &lt;&lt; " ";
          }
              cout &lt;&lt; endl;
      }
  </code></pre>
  
  <p>Help is appreciated. </p>