1) Probleml: Fibonacci Numbers (10 pts) Problem Statement: The Fibonacci sequenc
ID: 3586008 • Letter: 1
Question
1) Probleml: Fibonacci Numbers (10 pts) Problem Statement: The Fibonacci sequence is a series of numbers where a number is found by adding up the two numbers before it. Starting with 0 and 1, the sequence goes 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, and so forth. Written as a rule, the expression is xn - Xn-l + Xn-2. The Fibonacci sequence can also be generated from the relation below: 11+ 5 1-5 Write a MATLAB function (Fibonacci.m) that first asks the user to enter an integer vector (n). Then generates the first n numbers of Fibonacci sequence and using disp, fprintf commands displays the results as shown in table below Fibonacci (n) 0 2 2 15 610 Table of Fibonacci numbersExplanation / Answer
Ans:
y=input('Pick the second number for the sequence ');
k=input('Enter the total number of elements desired ');
fib=zeros(1,x);
fib(1)=x;
fib(2)=y;
s=3;
while s<=k
end
fprintf('The Fibonacci Sequence to %d terms is ',k);
disp(fib);
fprintf(' ');
valueOffib=zeros(1,x);
for s=1:k
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.