The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Index excedes matrix dimensions
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  

Posts: 3
Registered: 12/6/12
Index excedes matrix dimensions
Posted: Dec 9, 2012 1:42 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Here is my code for a loop that generates the Fibonacci sequence for the input values.

% Fibonacci
f(1) = input('Input first number in sequence ');
f(2) = input('Input second number in sequence ');
elem = input('Input number of elements ');
for j = 3:j
f(j) = f(j-1) + f(j-2);
Here's the thing, when I originally wrote this a few days ago it ran just fine for any input "elem" value up to 25. If I put in any number 25 or above, I got this message

Index exceeds matrix dimensions.

I opened it today, now it will only run for "elem" values 1 and 2, if I put 3 or above in I get the same thing,

Index exceeds matrix dimensions.

Error in Week10HW (line 35)

I did not change any of the code. Can somebody help me out, I'm kind of lost as to what this is about. Thanks.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.