This is the same as Problem 12.
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.
Back to basics 12 - Input Arguments
What is the distance from point P(x,y) to the line Ax + By + C = 0?
Make an awesome ramp for a tiny motorcycle stuntman
Generate a random matrix A of (1,-1)
Create an n-by-n null matrix and fill with ones certain positions
[Thermodynamics] Polynomial fitting of heat capacity data
Numerical differentiation with high precision
Volume of a truncated cube
[Thermodynamics] Estimate boiling point of n-alkanes
Find the treasures in MATLAB Central and discover how the community can help you!
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