I want to plot a 3D histogram of a matrix and I am using this line:
DiscretePlot3D[lmat[[x, y]], {x, 1, 3}, {y, 1, 3}, ExtentSize -> Full]
where lmat is the matrix.
The output is correct, but I receive the following error line:
Part::pspec: Part specification x is neither a machine-sized integer nor a list of machine-sized integers. >>
Where am I making a mistake? The line doesn't show up if I replace lmat[[x, y]] with a "standard" function such as Sin[x, y] or if I use a function defined by myself such as f[x_, y_] := Sin[x + y].
The line appear again if I use functions which involve matrices:
amat = {{1, -1, 0, 0}, {-1, 2, 0, -1}, {0, 0, 1, -1}, {0, -1, -1, 2}};
h[x_, y_] := amat[[x, y]]
DiscretePlot3D[h[x, y], {x, 1, 3}, {y, 1, 3}, ExtentSize -> Full]


- As you receive help, try to give it too, by answering questions in your area of expertise.
- Take the tour and check the faqs!
- When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– Aug 29 '15 at 10:22