Fibonacci sequence

版本 1.0 (13.0 KB) 作者: François Beauducel
Computes the generalized Fibonacci numbers as vectorized code.
4.0 次下载
更新时间 2023/11/5

Fibonacci sequence

fibonacci.m

This is a simple GNU Octave/Matlab function to compute the Fibonacci sequence or numbers. Function is vectorized.

Syntax

FIBONACCI(N) computes the Fibonacci number of N. N can be a scalar, vector or matrix of integers. Negative numbers are allowed (negafibonacci).

FIBONACCI without input argument returns the first 10 numbers of the Fibonacci sequence.

Examples

> fibonacci(7)
    13
> fibonacci(0:10)
    0  1  1  2  3  5  8 13 21 34 55

Documentation

Type doc fibonacci or help fibonacci for syntax and options. See also users comments and rating on View Fibonacci sequence on File Exchange.

References

https://en.wikipedia.org/wiki/Fibonacci_sequence

Author

François Beauducel

引用格式

François Beauducel (2024). Fibonacci sequence (https://github.com/beaudu/fibonacci/releases/tag/v1.0), GitHub. 检索时间: .

MATLAB 版本兼容性
创建方式 R2023b
兼容任何版本
平台兼容性
Windows macOS Linux
标签 添加标签
致谢

参考作品: Fibonacci.m

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库