Info

This question is closed. Reopen it to edit or answer.

Fibonacci function without using the fibonacci function (for loop)

1 view (last 30 days)
I am doing pracite questions and stuck on this one:
Write a MATLAB program that creates and outputs the first 30 numbers in the Fibonacci series. In your code, explicitly assign the first two numbers in the series, then built up the rest of series using a for-loop. Do not use MATLAB's fibonacci function. Output the 30 numbers, 5 numbers per line over 6 lines. Use an 8-character field width for each number. One final thing. Create all the output using a single fprintf statement that executes just once.
I am new to MATLAB and this function, and could really use some help on figuring out how to go about this!
  1 Comment
Rik
Rik on 19 Mar 2020
Just like your other questions: go at it step by step. Did you manage to write code that will generate the Fibonacci sequence? How can you use fprintf to print a vector? (hint: you should be using a vector to store the sequence)

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!