matlab question .. help needed thanks in advance Recall the definition of the Fi
ID: 3676370 • Letter: M
Question
matlab question .. help needed
thanks in advance
Recall the definition of the Fibonacci numbers from last recitation. Without using recursion, please write a MATLAB function that accepts an input parameter n and returns (outputs) a vector with the first 'n' numbers in the series. Example usage: x = Fibonacci (10) x = 1.1 2 3 5 8 13 21 34 55 Provide the code and sample output for a simplified solution that only needs to work for inputs in the range 2 less than n less than 100. You can name your function Fibonacci Simplified. Provide the code and sample output for a full solution that also works for any 0 less than; n less than 100. You can name this function Fibonacci FullExplanation / Answer
This below Matlab code will print the Matlab numbers from 0 to n i.e 100
with using recursion algorithm pattern..see the below code to print the series of Fibonacci
function f = fibonacci(n)
if (n==1)
f= 1;
elseif (n == 2)
f = 2;
else
f = fibonacci(n-1) + fibonacci(n-2);
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.