Borrar filtros
Borrar filtros

Problem with Fibonacci For loop

4 visualizaciones (últimos 30 días)
Mary Jeppson
Mary Jeppson el 12 de Mayo de 2016
Comentada: Mary Jeppson el 13 de Mayo de 2016
Here is my code:
f(1) = input('What is the first number of the sequence?')
f(2) = input('What is the second number?')
n = input('How many elements would you like to calculate?')
for k = 3:n
f(k) = f(k-2)+f(k-1)
end
Why am I exceeding matrix dimensions? Thanks for your help.
  2 comentarios
Jos (10584)
Jos (10584) el 12 de Mayo de 2016
It runs fine with me. When and where does the error occur?
Mary Jeppson
Mary Jeppson el 13 de Mayo de 2016
Thanks Jos,the program stopped reporting the error. Thank you for your reply.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Logical 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