Fibonacci
Version 1.0.0 (1.13 KB) by
Toby
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.
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));
Cite As
Toby (2026). Fibonacci (https://www.mathworks.com/matlabcentral/fileexchange/74580-fibonacci), MATLAB Central File Exchange. Retrieved .
Dasdan, Ali. Twelve Simple Algorithms to ComputeFibonacci Numbers. KD Consulting, 2018.
MATLAB Release Compatibility
Created with
R2012a
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0 |
