I don't get why this isn't correct.
I got the equation from 1) and the calculations are correct when I use Matlab at home (see 2)).
1) https://en.wikipedia.org/wiki/Fibonacci_number#Matrix_form
2) https://en.wikipedia.org/wiki/Fibonacci_number#List_of_Fibonacci_numbers
this would work if you returned floor(f).
Thank you =)
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
n = 1;
f = 1;
assert(isequal(fib(n),f))
|
2 | Fail |
%%
n = 6;
f = 8;
assert(isequal(fib(n),f))
Error: Assertion failed.
|
3 | Fail |
%%
n = 10;
f = 55;
assert(isequal(fib(n),f))
Error: Assertion failed.
|
4 | Fail |
%%
n = 20;
f = 6765;
assert(isequal(fib(n),f))
Error: Assertion failed.
|
Find state names that end with the letter A
708 Solvers
519 Solvers
Back to basics 22 - Rotate a matrix
763 Solvers
299 Solvers
A Simple Tide Gauge with MATLAB
342 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!