# Plotting error table in 3D

I have an error table which includes three parameters(error, epsilon and step size) and the matrix is not square. Now, I want to plot my data in 3D, but didn't manage to do it. My table is as follows

or

ϵ = {2^-4, 2^-5, 2^-6, 2^-7, 2^-8, 2^-9};
step = {2^-6, 2^-7, 2^-8, 2^-9};
error = {{9.06*10^9, 5.68*10^10, 3.55*10^11, 2.21*10^12}}


Any ideas how to tackle the problem ?

-
Well, include the data, not just an image :) – Sektor Mar 25 '14 at 11:30
Thank you for correcting my mistakes @Sektor. Is there any idea to solve this problem ? – drxy Mar 25 '14 at 12:28

This is ugly and can be optimized significantly, but as a first shot:

First create an {x,y,z} list from your data. (I filled the error matrix with the first line values. )

data=Flatten/@Transpose[{Flatten[Outer[List, \[Epsilon], step], 1], Flatten[error]}];


Maybe some explanations:

First make {x,y} paoirs from the [Epsilon] and step vectors:

Outer[List, \[Epsilon], step] // Short

(* {{{1/16,1/64},{1/16,1/128},{1/16,1/256},{1/16,1/512}},<<4>>,<<1>>} *)


Flatten gets rid of a superfluous Level of Lists:

Flatten[Outer[List, \[Epsilon], step], 1] // Short

(*{{1/16,1/64},{1/16,1/128},{1/16,1/256},<<19>>,{1/512,1/256},{1/512,1/512}}*)


Flattening the error Matrix gives a vector of same length as the vecotr of {x,y} pairs that we just created

Flatten[error] // Short

(*{9.06*10^9,5.68*10^10,3.55*10^11,<<18>>,5.68*10^10,3.55*10^11,2.21*10^12}*)


Transpose takes the two vectors and fuses them component-wise:

Transpose[{Flatten[Outer[List, \[Epsilon], step], 1],Flatten[error]}] // Short

(*{{{1/16,1/64},9.06*10^9},<<22>>,{{1/512,1/512},2.21*10^12}}*)


We now have to get rid of the List brackets around the {x,y} pairs by mapping Flatten to it. /@ is short-hand for Map)

Flatten/@Transpose[{Flatten[Outer[List, \[Epsilon], step], 1],Flatten[error]}] // Short

(*{{1/16,1/64,9.06*10^9},{1/16,1/128,5.68*10^10},<<21>>,{1/512,1/512,2.21*10^12}}*)


and now using ListPlot3D or ListPointPlot3D to visualize the data. You should consider plotting the Log values instead of the decimal ones.

Show[{ListPlot3D[data],ListPointPlot3D[data, PlotStyle -> Directive[Red, PointSize -> Large]]}]


-
Thank you very much Markus Roellig and Sektor. – drxy Mar 25 '14 at 13:52
@Markus Roellig Markus, you said, he shold consider plotting the Log values, but how can I plot the Log values and regadless see this information in the plot? I mean something like ListLogPlot. – Phab Mar 25 '14 at 15:57
@Phab just replace data by Log@data (or Log10@data). – Markus Roellig Mar 26 '14 at 7:29
@Markus Roellig Well, with this I'll get a plot with logarithmic dimensions, but I can't see the information (that is used the logarithmic data) on the plot (or the axis labels). What I want to do, is change the axes label(s). – Phab Mar 27 '14 at 7:25