a sequence of a sum of product
1 view (last 30 days)
Show older comments
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
2 Comments
Accepted Answer
Roger Stafford
on 5 Feb 2015
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.
2 Comments
More Answers (0)
See Also
Categories
Find more on Assumptions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!