Problem with Fibonacci For loop
Mostra commenti meno recenti
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 Commenti
Jos (10584)
il 12 Mag 2016
It runs fine with me. When and where does the error occur?
Mary Jeppson
il 13 Mag 2016
Risposte (0)
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!