How to set Reallyl Basic iterative sum

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
% f = n*sin(n*x) ;
thesum = 0 ;
for n = 1:10
thesum = thesum+n*sin(n*x);
end

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息

产品

标签

Community Treasure Hunt

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

Start Hunting!

Translated by