What is the error in this code for calculation of fibonacci number using golden ratio concept

Answers (1)

No, it doesn't work like that. The expression 's=(1+1/s)' tells how the golden ratio is defined, namely s = (1+sqrt(5))/2. Look up the Wikipedia website at:
http://en.wikipedia.org/wiki/Golden_ratio
in the section on the "Relationship to fibonacci sequence". It tells how the n-th term in the fibonacci sequence can be calculated without generating the values of all the previous terms. Of course there will be rounding errors present in such a computation, so you will need to round the answer to the nearest integer. Using matlab's double precision numbers this works up to about n = 70. After that the values become too large to be expressed accurately with double numbers and you would need to use the symbolic toolbox with an appropriately higher precision.

Categories

Find more on Elementary Math in Help Center and File Exchange

Tags

Asked:

on 26 Jun 2013

Community Treasure Hunt

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

Start Hunting!