Convolution offers some good ways to do this. Although you may need to slightly modify your input if you only partially average the ends (i.e., the former is averaged with the latter in your example, but the latter is not averaged with the former).
conv([A(end),A],[0.5 0.5],'valid') ans = 1.5000 1.5000 1.5000 3.0000 5.0000 3.5000 1.0000
The generalized case here for the moving average size N is:
conv(A([end-N+2:end, 1:end]),repmat(1/N,1,N),'valid')
source share