Anonymous function to return the desired number(s) of the Fibonacci sequence. Function is zero-based; i.e. fib(0) = 0, fib(1) = 1, etc.
fib = @(x) round(((1+sqrt(5))./2).^x./sqrt(5));
引用格式
Toby (2024). Fibonacci (https://www.mathworks.com/matlabcentral/fileexchange/74580-fibonacci), MATLAB Central File Exchange. 检索时间: .
Dasdan, Ali. Twelve Simple Algorithms to ComputeFibonacci Numbers. KD Consulting, 2018.
MATLAB 版本兼容性
创建方式
R2012a
兼容任何版本
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0 |