Please, feel free to edit the title, if necessary.
Hi, this is my code working, but actually, the size of my real dataset is 100x100. So, this is very inefficient way. What would be the most efficient way to make this work? Please, see an attached photo. What I'm trying to do are doubling my data by Interpolation or extrapolation function and generating x- and y-axis, automatically.
Here is my inefficient code.
mat = {{0, 1, 2, 3}, {1, 1, 2, 3}, {2, 2.83, 8, 17}, {3, 5.12, 18,
46.7}};
x1 = mat[[2 ;;, 2]];
x2 = mat[[2 ;;, 3]];
x3 = mat[[2 ;;, 4]];
TableForm@mat
intx1 = Interpolation[x1];
intx2 = Interpolation[x2];
intx3 = Interpolation[x3];
doublex1 = Flatten[Table[{intx1[x]}, {x, 6}], 1];
doublex2 = Flatten[Table[{intx2[y]}, {y, 6}], 1];
doublex3 = Flatten[Table[{intx3[z]}, {z, 6}], 1];
doublemat = Transpose[{doublex1, doublex2, doublex3}];
(*In my actual data set, the size of matrix is 100 x 100. So, this \
method won't be efficient at all*)
xaxis = Flatten[Range[1, Flatten[Dimensions[x1], 1], 1], 1];
yaxis = Flatten[Range[0, 2*Flatten[Dimensions[x1], 1], 1], 1];
xdoublemat = Join[{xaxis}, doublemat];
yxdoublemat = Join[List /@ yaxis, xdoublemat, 2];
TableForm@yxdoublemat
Interpolation
, you are in fact fitting the three points in each column to a quadratic polynomial and then using that polynomial to extrapolate three more points. In a hundred point column, the default forInterpolation
will fit the last four points to a cubic, from which another 100 points will be determined by extrapolation. Is this what you really want? If so, some version ofMap
will allow the code to be written compactly. UseQuiet
to suppress the many warning messages. $\endgroup$