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:
<em>function v = myfib(n,v)</em>
<em>if nargin==1</em>
<em> v = myfib(n-1,[0,1]);</em>
<em>elseif n>1</em>
<em> v = myfib(n-1,[v,v(end-1)+v(end)]);</em>
<em>end</em>
<em>end</em>
<em>function v = myfib(n,v)</em>
<em>if nargin==1</em>
<em> v = myfib(n-1,[0,1]);</em>
<em>elseif n>1</em>
<em> v = myfib(n-1,[v,v(end-1)+v(end)]);</em>
<em>elseif n<1</em>
<em> v = 0;</em>
<em>end</em>
<em>function [n] = abcd(x)</em>
<em>if (x == 1 || x==0)</em>
<em> n = x; </em>
<em> return</em>
<em>else</em>
<em> n = abcd(x-1) + abcd(x-2);</em>
<em>end</em>
<em>end</em>
<em>fibonacci = [0 1];</em>
<em>for i = 1:n-2</em>
<em> fibonacci = [fibonacci fibonacci(end)+fibonacci(end-1)];</em>
<em>end</em>
<em>>> myfib(8)</em>
<em>ans =</em>
<em> 0 1 1 2 3 5 8 13</em>
<em>>> myfib(10)</em>
<em>ans =</em>
<em> 0 1 1 2 3 5 8 13 21 34</em>
See more about python at brainly.com/question/18502436