# Plotting six chosen rows of a matrix

I have a matrix,W, whose dimension is n x n, each entry is a number. I need to plot only the values of six rows, namely those labelled by the row index i equal to:

n/32, 3*n/64, n/16, 3*n/32, n/8, 3*n/16, n/4, 3*n/8


For every row I need to plot all of the n values that are in the row. I should end up with six plots, hopefully all in the same page. I guess I should use ListLinePlot, but how exactly can I do that?

EDIT: instead of using the value of i mentioned before, I am now using i= 1,2,3,4, just to practise. I am following @belisarius advice, using:

l = {1, 2, 3, 4};
ListLinePlot[W[[l]], PlotLegends -> l]


to plot the 4 graphs. But I keep having the following error:

 Part {1,2,3,4} of (<<1>>) does not exist.


Why does this happen and how can I fix it?

EDIT: Here is my whole code. The problem is in the Wab matrix, which seems not to make sense, as I cannot plot the desired values mentioned above.

getA[kappa_] :=
Table[2*Cos[(2*Pi/n)*(Abs[j - i])*kappa], {i, n}, {j, n}];
getF[csi_, a_, b_] :=
Module[{csiInv = Inverse[csi]}, .5 Tr[csiInv.a.csiInv.b]];
getG[csi_, f_, a_] := Module[{csiInv = Inverse[csi]},
csiInv.a.csiInv/2];
getE[g_, k_] := Module[{kinv = Inverse[k]},
Transpose[kinv].g.kinv];
getW[k_, a_, e_] := Module[{ktrans = Transpose[k]},
Tr[k.a.ktrans.e]];
getV[csi_, e_, e2_, k_] :=
Module[{ktrans = Transpose[k], e2trans = Transpose[e2]},
2*Tr[csi.ktrans.e.k.csi.ktrans.e2trans.k]];
getP[g_, delta_] := Module[{deltatranspose = Transpose[delta, {1}]},
deltatranspose.g.delta];

n = L = 16;
sigma = 3;
nyquist = n/2 + 1;
sampling = 8;
mu = 0.0;

powerspectrum[i_] :=
Piecewise[{{0, i == 0}, {Exp[-(2*Pi*i*sigma/L)^2],
0 < i <= n/2}, {Exp[-(2*Pi*(n - i)*sigma/L)^2], n/2 < i <= n}}];
pts = Table[powerspectrum[i], {i, 0, n - 1}] ;

inverse = InverseFourier[pts];
func[inverse_] :=
Module[{n = Length[inverse], tup},
tup = Cases[
Tuples[Range[n], 2], {i_, j_} /; Abs[i - j] < (n - 1)/2];
SparseArray[
Thread[tup -> (inverse[[Abs[#1 - #2] + 1]] & @@@ tup)], {n, n}]];
CSI = func[inverse];

Kmatrix =
Table[((3.0*70.0*70.0*0.3)/(2.0*300000.0*300000.0))*((j + 1)*(i +
2 - (j + 1)))*(1.0 + (70.0/300000.0)*(j + 1)), {i, 0,
n - 1}, {j, 0, n - 1}];

leftREAL =
Table[RandomVariate[
NormalDistribution[mu, Exp[-(2*Pi*k*sigma/L)^2]]], {k, n/2}];
rightREAL = Reverse[leftREAL] /. {x_, y_} -> {n - x, y};
fullREAL = Join[{0.0}, Most[leftREAL], rightREAL];

leftIMAGINARY =
Table[RandomVariate[
NormalDistribution[mu, Exp[-(2*Pi*k*sigma/L)^2]]], {k, n/2 - 1}];
rightIMAGINARY = -Reverse[leftIMAGINARY] /. {x_, y_} -> {n - x, y};
fullIMAGINARY = Join[{0.0}, leftIMAGINARY, {0.0}, rightIMAGINARY];

fullfield = fullREAL + I*fullIMAGINARY;

fieldconfiguration = InverseFourier[fullfield];

Wab = Table[
getW[Kmatrix, getA[beta],
getE[getG[CSI, getF[CSI, getA[alpha], getA[alpha]], getA[alpha],
Kmatrix]]], {alpha, n}, {beta, n}];


n = 64;

• @johnhenry Then your W isn't a 4x4 (or larger) matrix ... – Dr. belisarius Apr 13 '15 at 17:49
• @johnhenry Please try the code with Wab = RandomReal[{0, 1}, {n, n}]; . If it works .... it's your matrix :) – Dr. belisarius Apr 13 '15 at 18:13