The following code gives 20 data as output.
How can I make a 5*4 matrix by that data list?
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
You can then enter your definition of c and s
MatrixForm
. It is the cause for so many desperate questions on this forum... (still +1).
$\endgroup$
Commented
Nov 4, 2018 at 16:07
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}
]
Table[If[OddQ[j], Cos, Sin][2. Pi i j/(2 n + 1)], {i, -n, n}, {j, 2 n}]
$\endgroup$
Commented
Nov 4, 2018 at 18:19
Table
, and don't forget to capitalizeSin
andCos
. $\endgroup$For
$\endgroup$