Can someone help me with a question to do with sequences and creating a function file that find n terms of sequence

1 次查看(过去 30 天)
Can someone show me the function file that would calculate the first n terms of this sequence a_i=a_(i-1)+3i as well as the sum of the first n terms please!

采纳的回答

Roger Stafford
Roger Stafford 2016-12-12
编辑:Roger Stafford 2016-12-12
a = a_0 + cumsum(3:3:3*n); % The sequence of first n terms
s = sum(a); % The sum of these

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by