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
Tresset [83]
4 years ago
11

Write a function called interweave that takes in two vectors and then outputs a larger vector where the odd elements contain the

values from the first vector, and the even elements contain the values from the second vector. if one vector is longer than the other, then the odd or even indices that wouldn't otherwise have values should be filled with zeros. for
Mathematics
1 answer:
yulyashka [42]4 years ago
4 0

solution:

function weaved=interweave(A,B)

lenA=length(A);

lenB=length(B);

diff=abs(lenA-lenB);

if lenA>lenB

len=2*lenA;

for j=(lenB+1):(lenB+diff)%adds zero to shorter vector

B(j)=0;

end

else

len=2*lenB;

for j=(lenA+1):(lenA+diff)%adds zero to shorter vector

A(j)=0;

end

end

cnt=1;

for i=1:2:(len-1)

weaved(i)=A(cnt);

weaved(i+1)=B(cnt);

cnt=cnt+1;


You might be interested in
3x^2+42x+105=0 Find the solution<br><br>  <br>  <br> 0<br> 0
Nina [5.8K]

Step-by-step explanation:

I think we have to find the factors so

3x2 + 42x + 105

First we will multiply 105 by 3 = 315 then find factors of 315 which may add or subtract = 42

So 45 and 7

3x2 + 45x - 7x + 105

3x( x + 15) - 7(x - 15)

(3x - 7) and ( x - 15) are the factors

There is a problem please recheck the question

6 0
3 years ago
Danny had $116 to spend on nine books. After buying them he had $72 left. How much did each book cost?
alexdok [17]
$4.89
- First subtract 116-72
-then divide that answer by nine
-round 
8 0
3 years ago
Read 2 more answers
Simplify 4x + 3y + 6 + 2x + 4y
Ad libitum [116K]

You add like terms, which means add the values with the x value, and the values with the y value, and never mix them. So for the x values, you have 4x + 2x, which equals 6x. Then you add the y values, 4y + 6y to get 10y. Then you add them to the remaining 6, and get

5x + 10y + 6

6 0
3 years ago
Read 2 more answers
a farmer has 10 acres to plant in wheat and rye. He has to plant at least 7 acres. However, he has only $1200 to spend and each
Jobisdone [24]

Answer:

4 acres of wheat and 4 acres of rye.

Step-by-step explanation:

Given: Farmer has only 7 acre, he has plant at least 7 acres.

          Farmer has only $1200 to spend.

          Each acre of wheat will cost $200 and rye will cost $100.

          Planting time is only 12 hours

          Wheat planting take 1 hour per hour and rye take 2 hours per acre.

          Profit on wheat is $500 per acre and rye $300 per acre.

As to find out maximum profit, we need to plant maximum wheat.

While dividing number of acres of land for wheat and rye for plantation, we need to keep two constraint in the mind; Constraint of cost and time as given.

Lets assume few number considering these constraint to get maximum profit.

First assumption, 5 acres of wheat and 2 acres of rye

Time taken= 5\times 1= 5 h\\2\times 2= 2 h

Total time taken 7 hours

Amount spent= 5\times 200= \$ 1000\\2\times 100= \$ 200

Total cost is $ 1200.

Profit= 5\times 500= \$ 2500\\2\times 300= \$ 600

Maximum profit= $3100.

Second assumption, 4 acres of wheat and 4 acres of rye.

Times taken= 4\times 1= 4 h\\4\times 2= 8 h

Total time taken is 12 hours

Amount spent= 4\times 200= \$ 800\\4\times 100= \$ 400

Total cost is $1200.

Profit= 4\times 500= \$ 2000\\4\times 300= \$ 1200

Maximum profit= $3200.

∴ By using hit and trail method, we can see that we are getting maximum profit when farmer is planting 4 acres of wheat and 4 acres of rye.                

8 0
3 years ago
Find the perimeter of the shaded figure. Please help,thanks!
ahrayia [7]

Answer:

I believe its 40

Step-by-step explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Specialty t-shirts are being sold online for $30 each, plus a one-time handling fee of $2.25. The total cost is a function of th
    13·1 answer
  • . A survey showed that five out of every seven students in 8th grade do their homework
    11·2 answers
  • of 30 students , 1/3 play sports. Of those who play sports, 2/5 play soccer. How many students play soccer?​
    7·2 answers
  • What is the exterior angle?
    7·1 answer
  • The charges for an international call made using the calling card for two phone companies are shown in the table. a. What is the
    6·1 answer
  • A lot of in the shape of a trapezoid has an area of 6550 square centimeters it's longer base measures 150 centimeters and the sh
    12·1 answer
  • Combine and simplify these radicals. 160 40<br><br>I AM TIMED!!!
    12·2 answers
  • Multiply (5x-2)^2
    13·1 answer
  • 5. Find the solution to the equation 3x+4=31? EXPLAIN how you found your 2 points<br> answer. *
    13·1 answer
  • Convert 714 years to minutes. (please show the steps to how you did the problem.)
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!