How do I calculate the values of the fibonacci sequence using a while loop in matlab?

3 views (last 30 days)
I am given the vector fib=[0,1]. I am told to create a new vector that continues the list of Fibonacci sequence values after the given vector using a while loop. The limit is 5702887. I am also given that there should be 26-39 elements in the new vector. My last step is to output the number of elements in the vector and their corresponding values. I am a beginner at matlab and am unfamiliar with while loops. Could someone please help me?
  1 Comment
Torsten
Torsten on 26 Nov 2015
If you are not familiar with while-loops, try a for-loop together with an if-statement first. We will then help you to transform your code to include a while loop.
Best wishes
Torsten.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 26 Nov 2015
You have also already had multiple copies of this questions closed as duplicates.
You need to stop re-posting your question and start using what you learned in the answers you have already been given. If there is something in those answers you do not understand, ask there. Do no keep reposting the same question.
When you continue to post the same question after having been given answers on the techniques to use, it makes it look like what you are asking is for someone to give you the solution to your homework.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!