Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: fibonacci numbers
Date: Wed, 19 Nov 2008 00:26:20 +0000 (UTC)
Organization: Xoran Technologies
Lines: 17
Message-ID: <gfvmfc$89e$1@fred.mathworks.com>
References: <gfv1n2$r4j$1@fred.mathworks.com> <gfvi5t$39q$1@fred.mathworks.com> <gfvju6$8er$1@fred.mathworks.com> <gfvltu$qpd$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1227054380 8494 172.30.248.35 (19 Nov 2008 00:26:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 19 Nov 2008 00:26:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:501614


"Matt" <mjacobson.removethis@xorantech.com> wrote in message <gfvltu$qpd$1@fred.mathworks.com>...
> "Maria " <mariaki16@hotmail.com> wrote in message <gfvju6$8er$1@fred.mathworks.com>...
> > no becouse we don't know the array.is given by the user.so i have to create a formula for a random array...the golden radio is recomented to do the formula(http://www.mathworks.com/moler/intro.pdf)
> 
> Sorry, I didn't understand that. What is "the array"?
> 
> I thought the user inputs the value of n. Once you know n, you can evaluate Fn from the formula.

Just to be clear, this is the implementation I'm thinking of:

g=(1+sqrt(5))/2;  %The golden ratio

F=@(n) (g.^n- (1-g).^n)/sqrt(5);  %Formula for n-th Fibonacci number

sequence= F(0:n); %Fibonacci sequence from 0 to n