Discover the answers to your questions at Westonci.ca, where experts share their knowledge and insights with you. Experience the convenience of getting accurate answers to your questions from a dedicated community of professionals. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform.

Homework 8 Matlab Write a function called fibonacciMatrix. It should have three inputs, col1, col2, and n. col1 and col2 are vertical arrays of the same length, and n is an integer number greater than 2. It should return an output, fib, a matrix with n columns. The first two columns should be col1 and col2. For every subsequent column:

Sagot :

In this exercise we have to use the knowledge in computational language in python to write the following code:

We have the code can be found in the attached image.

So in an easier way we have that the code is:

function v = myfib(n,v)

if nargin==1

   v = myfib(n-1,[0,1]);

elseif n>1

   v = myfib(n-1,[v,v(end-1)+v(end)]);

end

end

function v = myfib(n,v)

if nargin==1

   v = myfib(n-1,[0,1]);

elseif n>1

   v = myfib(n-1,[v,v(end-1)+v(end)]);

elseif n<1

   v = 0;

end

function [n] = abcd(x)

if (x == 1 || x==0)

   n = x;

   return

else

   n = abcd(x-1) + abcd(x-2);

end

end

fibonacci = [0 1];

for i = 1:n-2

   fibonacci = [fibonacci fibonacci(end)+fibonacci(end-1)];

end

>> myfib(8)

ans =

   0    1    1    2    3    5    8   13

>> myfib(10)

ans =

   0    1    1    2    3    5    8   13   21   34

See more about python at  brainly.com/question/18502436

View image lhmarianateixeira