A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Fibonacci in Matlab page! Here, you’ll find the source code for this program as well as a description of how the program works.
function f = fibonacci(n)
if ischar(n)
error('Usage: please input the count of fibonacci numbers to output')
end
if n < 0
error('Usage: please input a non-negative integer')
end
if not(n==round(n))
error('Usage: please input an integer, not a floating point')
end
a(1) = 1;
a(2) = 1;
for i=1:n
a(i+2)=a(i+1)+a(i);
end
f = mat2str(a);
end
Fibonacci in Matlab was written by:
If you see anything you’d like to change or update, please consider contributing.
Note: The solution shown above is the current solution in the Sample Programs repository as of Nov 05 2019 15:10:54. The solution was first committed on Oct 24 2019 15:37:31. As a result, documentation below may be outdated.
No ‘How to Implement the Solution’ section available. Please consider contributing.
No ‘How to Run the Solution’ section available. Please consider contributing.