Fibonacci sequence

Computes the generalized Fibonacci numbers as vectorized code.
ダウンロード: 2
更新 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 リポジトリにアクセスしてください。