Question: Part 4: User-defined functions (19 points) The Fibonacci sequence is characterized by the set of numbers beginning with Fi 1, F2 1, and every following

 Part 4: User-defined functions (19 points) The Fibonacci sequence is characterized
by the set of numbers beginning with Fi 1, F2 1, and

Part 4: User-defined functions (19 points) The Fibonacci sequence is characterized by the set of numbers beginning with Fi 1, F2 1, and every following number is the sum of the previous two numbers: F F-2+ F-1. Create a user-defined function that calculates a sequence similar to the Fibonacci sequence using any two starting numbers-F-a, F2 = b,R-Fn-2 + Fn-1-and returns the nth number in the sequence. Before you begin writing your function, take some time to answer these questions. All answers should be written in the appropriate space in the table on the last page. What is the name of your function going to be? NOTE: The rules for naming functions are the same as naming scripts and variables in MATLAB Write a short line stating the purpose of your function. What input arguments do you need in order to transfer data into the function? Write out each input argument; its name and description. Think about what data you need from the user in order to perform the appropriate calculations. DO NOT use the input) function in MATLAB for this part. What output arguments do you need in order to transfer data out of the function? Write out each output argument; its name and description. Think about what information/data the user wants from the calculations. Write down the function definition line for your function using your answers in parts 1, 2, and 3 1. 2. 3. 4. 5. 6. Complete your function body by translating the following steps into MATLAB code: if the nth number is 1 if the nth number is 2 anything else return Fi return F2 for the number of desired terms starting at 3 return Fo Fnz+ Fnl

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!