(Solved) Help with please these are hard

1 view (last 30 days)
Ali Ece
Ali Ece on 26 May 2021
Commented: Rena Berman on 29 Jun 2021
' Write a function called threshold that determines the number of terms required for the sum
In other words, your output arguments are terms that gives the number of n required for
sum to exceed a limit; and total that gives that sum.'

Sign in to comment.

Accepted Answer

Torsten on 26 May 2021
Edited: Walter Roberson on 26 May 2021
function [n,summa] = threshold(limit)
summa = 0;
n = 0;
while summa <= limit
n = n+1;
summa = summa + 5*n^2 - 2*n;

More Answers (1)

Nikita Agrawal
Nikita Agrawal on 26 May 2021
function [number_of_terms] = threshold(limit)
T = 0;
while T < limit
T = T + 5*k*k-2*k;
k = k+1;

Community Treasure Hunt

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

Start Hunting!