MATLAB: A sequence of a sum of product

Extended Symbolic Math Toolboxsubsindexsymblic

I have a sequence H and a function (erfc).
I want to find a sequence of a sum of product such that
H=[1 2 3 4 5 6 7 8 9 0]
for p =(1:10)
h(p) = H(m)*erfc(p-m+1) where m goes from 1 to p
that means
h(1) = H(1)* erfc(1)
h(2) = H(1)*erfc(2)+ H(2)* erfc (1)
h(3) = H(1)*erfc(3) + H(2)*erfc(2)+H(3)*erfc(1)
h(4) = H(1)*erfc(4)+H(2)*erfc(3)+H(3)*erfc(2)+H(4)*erfc(1)
and so on
My biggest hurdle is to indexing sequence H so that I can multiply with the function. I am getting error related to sym/subsindexing.
Any help is greatly appreciated.
Thank you Maharjan

Best Answer

You can vectorize your summation. I assume H is a 10-element row vector as you have shown it.
h = zeros(10,1);
for p = 1:10
h(p) = H(1:p)*erfc((p:-1:1)');
end
Note: You could also use matlab's 'conv' (convolution) function.