Compute the n-th Fibonacci Number
f(0) = 0,
f(1) = 1,
f(2) = 1,
f(3) = 2, ...
f(42) = 267914296
This solution returns f(0) = 1, which contradicts the decription of the given problem.
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 suite is flawed. I had to add a round(x,0) function to the output to make it pass.
Test is correct. Fibonacci Numbers are integers, so your output should be to.
Factorize THIS, buddy
Back to basics 12 - Input Arguments
Permute diagonal and antidiagonal
Generate a NaN...on purpose
Sum the 'edge' values of a matrix
[Thermodynamics] Estimate boiling point of n-alkanes
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office