For a list of any given length, I want to generate another list from it adding elements which are mean of the consecutive elements, in between the elements, of the original list. For example:
list = {a, b, c};
newlist = {a, (a+b)/2, b, (b+c)/2, c}
I have written this function which does the job but I need much more elegant solution:
intFunc[list_] := Module[{list1},
list1 = ConstantArray[0, 2*Length[list] - 1];
Table[list1[[2*i - 1]] = list[[i]], {i, 1, Length[list]}];
Table[list1[[2*i]] = (list[[i]] + list[[i + 1]])/2, {i, 1, Length[list] - 1}];
list1
];