MATLAB Answers

i did this but cant sure about my howemork question 2. can anyone help me?

1 view (last 30 days)

Answers (1)

Geoff Hayes
Geoff Hayes on 19 May 2020
Emre - the question is asking you to write a function called threshold that determines the number of terms required for the sum of the series (see pdf) to exceed an input variable called limit. That means that you need to keep summing up your terms until that sum exceeds the limit
if summa > limit
You probably don't want to use a for loop since you don't know how many iterations are necessary until that limit is exceeded. Also, in your code, you use k as your for loop step variable and also use it to for a calculation. It isn't always a good idea to re-use variables in this way as it could lead to unpredictable results so consider using a different variable name (for one of these two) or just move the calculation to the line of code where you update the sum.


Sign in to comment.