This solution uses filter from the Signal Processing Toolbox.
Yes, it uses filter, but filter is indeed not a toolbox function, but a built-in function. You can fix the error by changing f=y(n-2) to f = y(n)
... and then change first input of filter to [1,-1] and remove +1 from the end of the line.
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
%%
assert(isequal(fibonacci(1),1))
assert(isequal(fibonacci(2),1))
assert(isequal(fibonacci(5),5))
assert(isequal(fibonacci(7),13))
assert(isequal(fibonacci(13),233))
assert(isequal(fibonacci(15),610))
y =
2
|
280 Solvers
Sum of diagonal of a square matrix
1327 Solvers
Who is the smartest MATLAB programmer?
561 Solvers
convert matrix to single column
306 Solvers
400 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!