I want to sum up all n*sin(n*x)-terms. I've found that
f = n*sin(n*x)
for n = 1:10
f(n+1) = n*sin(n*x);
end
sum(f)
works. However, in my view it's not that elegant. In other words, how to implement without using 'sum'?

 채택된 답변

KSSV
KSSV 2021년 1월 15일
편집: KSSV 2021년 1월 15일

0 개 추천

% f = n*sin(n*x) ;
thesum = 0 ;
for n = 1:10
thesum = thesum+n*sin(n*x);
end

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

제품

태그

질문:

2021년 1월 15일

편집:

2021년 1월 15일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by