Posted by **George** on Friday, July 8, 2011 at 8:19pm.

I guess it was skipped

One interesting property of a Fibonacci sequence is that the ratio of the values of adjacent members of the sequence approach a number called “the golden ratio” or PHI. Create a program that accepts the first two numbers of a Fibonacci sequence as a user input and then calculates additional values in the sequence until the ratio of adjacent values converges to within 0.001. You can do this in a WHILE loop by comparing the ratio of element k to element k-1 and the ratio of element k-1 to element k-2. If you call your sequence x, then the code for the WHILE statement is

while abs(x(k)/x(k-1) – x(k-1)/x(k-2))>0.001

I think I'm doing something wrong... Here's my attempt at a solution

a=input('Please enter the first two numbers of the Fibonacci sequence in "[# #]" form. Do not enter [0 1] or [1 1]. Your free to enter anything else though.');

x=[a ones(1,100000)];

z=3;

while abs(x(z)/x(z-1)-x(z-1)/x(z-2))>0.001

x(z)=x(z-2)+x(z-1);

z=z+1;

end

g=x(find(x>1));

## Answer this Question

## Related Questions

- Computer Science - MATLAB - One interesting property of a Fibonacci sequence is ...
- maths! please help me it is an emergency!!!!!!!!!! - what is the fibonacci ...
- Math (fibonacci - A sequence of numbers is called a Fibonacci-type sequence if ...
- math - The Fibonacci sequence of numbers begins 1,1,2,3,5,8,13,21,34,55,…and ...
- Fibonacci sequence - The Fibonacci sequence a1=1,a2=1,a3=2,a4=3,a5=5,a6=8… is ...
- Math - F25= 75,025 and F26= 121,393 where Fn is the nth term in the Fibonacci ...
- Pre-Calc - Find three examples of the Fibonacci sequence in nature. Write a ...
- Math - Hello, I can't find a pattern to answer this question, can you help? The ...
- Pre-calculus - Hello, Consider a geometric sequence with t3= 18 and t7= 1458. ...
- MATH - A new sequence is formed by adding together the corresponding terms of a ...