MATLAB: How to solve this in matlab

doit4mehomeworkMATLABno attemptsigma

hi guys how can I solve this in matlab?? 1.jpg

Best Answer

This solution relies on only one for-loop (although technically you could replace this for-loop, too). 'sumOut' is the solution to the equation.
kMax = 10;
out = zeros(1,kMax);
for k = 1:kMax
out(k) = sum(sin((pi + 0.1)./(1:k)) .* exp(-k/2));
end
sumOut = sum(out);