% 4-8-2008 % Golden Ratio clear all; close all; % Start out the Fibonacci sequence and record what the true golden ratio is x = [1 1]; phi = (1+sqrt(5))/2; % Iterative loop for i=3:1000 x(i) = x(i-1) + x(i-2); % Calculate the next member in the sequence r(i-2) = x(i) / x(i-1); % Calculate the ratio value if ( abs(r(i-2) - phi) < 10^(-10) ) % Check to see if we have reached our tolerance break; end end % Plot the convergence plot(r); axis([1 i 1.4 2]) title('Golden Ratio Convergence'); xlabel('Iteration'); ylabel('\phi');