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

1 visualización (últimos 30 días)

Respuestas (1)

Geoff Hayes
Geoff Hayes el 19 de Mayo de 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
break;
end
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.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by