Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Fibonacci function without using the fibonacci function (for loop)

1 vue (au cours des 30 derniers jours)
Charlotte Reed
Charlotte Reed le 19 Mar 2020
Commenté : Rik le 19 Mar 2020
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 commentaire
Rik
Rik le 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)

Réponses (0)

Cette question est clôturée.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by