1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sav [38]
1 year ago
14

Homework 8 Matlab Write a function called fibonacciMatrix. It should have three inputs, col1, col2, and n. col1 and col2 are ver

tical 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:
Computers and Technology
1 answer:
Amiraneli [1.4K]1 year ago
8 0

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

You might be interested in
PLS CAN ANYONE HELP ME
Nesterboy [21]

The exercise contains 15 questions. The solution is provided for each question.

Each question contains the necessary skills you need to learn.

I have added tips and required learning resources for each question, which helps you solve the exercise. When you complete each question, you get more familiar with a control structure, loops, string, and list.

Use Online Code Editor to solve exercise questions.

Also, try to solve the basic Python Quiz for beginners

Exercise 1: Given two integer numbers return their product. If the product is greater than 1000, then return their sum

Reference article for help:

Accept user input in Python

Calculate an Average in Python

Given 1:

number1 = 20

number2 = 30

Expected Output:

The result is 600

Given 2:

number1 = 40

number2 = 30

Expected Output:

The result is 70

Explanation:

4 0
2 years ago
This OS was created by a developer named Torvalds.
GREYUIT [131]
The answer to this problem is Linux
7 0
3 years ago
Pete would like to respond only to users within his organization with an automatic reply. He is configuring the automatic respon
Ahat [919]

Answer:

megan pete

Explanation:lol just  had to

4 0
2 years ago
Before the 20th century how did most people experience computing​
frozen [14]

Answer:

   

Explanation:

3 0
2 years ago
What's a common mistake that young people in relationships make?
allochka39001 [22]
B, i say b because oversharing something personal could result in somebody you thought you loved going back telling someone else, causing rumors to be spread out
3 0
2 years ago
Other questions:
  • The security administrator of ABC needs to permit Internet traffic in the host 10.0.0.2 and UDP traffic in the host 10.0.0.3. Al
    11·1 answer
  • How do i start makeing a Character in the Unreal Game Engine
    14·2 answers
  • Many computer magazines and Web sites present comparisons of several DBMSs. Find one such DBMS comparison article and compare th
    10·1 answer
  • Write a CPP Program to read an integer number. Use a pointer to display this numbe
    5·1 answer
  • Write a program that calculates the amount of money the salesperson will earn from selling discount cards. java program
    8·1 answer
  • Create a program that generates a report that displays a list of students, classes they are enrolled in and the professor who te
    11·1 answer
  • What is not true of efs
    11·1 answer
  • Match each career to its various job roles. digital media coordinator digital media specialist photographer sound producer creat
    13·1 answer
  • Question 1 (1 point)
    9·1 answer
  • The function below takes two arguments: a string (name) and an integer (position). Complete the function so that it prints out t
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!