ABCs_recursion - function ret = ABCs_recursion(num) % ABCs...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
function ret = ABCs_recursion(num) % ABCs of Recursion % % This is a multi-part problem. Do each of the parts below. % % DO NOT CHANGE THE FUNCTION HEADER (the first line of code) % % This ABC file will step you through writing your first recursive % function. You will write the Fibonacci function, which will take in a % number representing the fibonacci term which we want to find. We will % first write a wrapper function to handle input, then the recursive % function. % % PART 1. The wrapper function. % % Input (1): - "num" (anything) n % Output (1): - "ret" (double) the nth term of the Fibonacci sequence % % This part will involve you writing the code for the main function. In % the wrapper function, you should check to see if num is a double or not. % If it is not a double, then just return []. Otherwise we want to run our % recursive function, fib, with a positive integer or zero. To ensure your % input is a positive integer, round it and take the absolute value of it % with the abs() function before calling fib. if ~isa(num,'double')
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Institute of Technology.

Page1 / 2

ABCs_recursion - function ret = ABCs_recursion(num) % ABCs...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online