MATLAB: Given a vector of assorted positive integers, how to create a vector with the means of every 2 integers inserted between each other

insertingmeansequential mean insertionvector

I've managed to take the mean of the whole vector with the mean function, but this doesn't seem like the right path to take. I am thinking of: v= 2 6 8 3 1 9 4 5 7 m1= v(1,2:9) m2= [m1,v(end)] m3= [v;m2] vmeans=mean(m2)
there are quite a few intermediate steps just to get to the vector of the means by themselves.
any answers to get to these values better or how to insert those values in between each original integer are much appreciated
thanx

Best Answer

result = interp1(v, linspace(1, length(v), length(v)*2-1), 'linear')