2

The following code gives 20 data as output.

Enter image description here

How can I make a 5*4 matrix by that data list?

Peter Mortensen
  • 759
  • 4
  • 7
a b
  • 99
  • 3

2 Answers2

5

Here is a starting point without the For loops:

Clear@f; 
f[i_, j_] /; OddQ[j] := c[i, j]; 
f[i_, j_] /; EvenQ[j] := s[i, j]; 

n1 = 2; 
res = Table[f[i, j], {i, -n1, n1}, {j, 1, 2*n1}]; 

(* Note MatrixForm is for presentation, not for computations *)
    res // MatrixForm

enter image description here

You can then enter your definition of c and s

FredrikD
  • 1,868
  • 1
  • 13
  • 25
4
n = 2;
Table[
 If[OddQ[j],
  Cos[2. Pi i j/(2 n + 1)],
  Sin[2. Pi i j/(2 n + 1)]
  ],
 {i, -n, n}, {j, 1, 2 n}
 ]
Henrik Schumacher
  • 106,770
  • 7
  • 179
  • 309