TASK: Create a Fibonacci sequence with different starting values.
COMMENT: To get the next Fibonacci number, we add the two previous ones, and we start with values 1 and 1.
Now we simply want to use the same rule, but with the starting values 2 and 1. We want to calculate the next 10 values in this sequence.
INSTRUCTIONS:
We need to have three variable names. One possibility is to use "f1", "f2" and "f3", where "f3" is computed as f1 + f2. Before we begin, set f2 to 2 and f3 to 1. Create a for loop that counts from 1 to 10. We can use "i" for the counter variable. copy the value of f2 into f1 copy the value of f3 into f2 compute the new value of f3 print the new value of f3 Or you might use a fancy printout like this: fprintf ( ' %d + %d = %d\n', f1, f2, f3 ); end your FOR loop
SUBMIT: Your work should be stored in a script file called "hw018.m". Your script file should begin with at least three comment lines:
% hw018.m % YOUR NAME % This script (describe what it does) % Add any comments here that you care to make.If this problem is part of an assignment, then submit it to Canvas.