Question: Matlab question Write a function that takes a row array as an input and produces a matrix as an output. If the input array is

Matlab question

Write a function that takes a row array as an input and produces a matrix as an output. If the input array is n in length, the output matrix should be n x n. The first row of the matrix should be the original array. Every subsequent row should be the row above modified in the following way:

- The number in the last column is the same

- For the other columns, place the value from the previous row in that column times the value from the previous row in the next column.

For example, the input [1 -1 2 -2 -1] would produce the matrix:

1 -1 2 -2 -1

-1 -2 -4 2 -1

2 8 -8 -2 -1

16 -64 16 2 -1

-1024 -1024 32 -2 -1

In the above matrix, for each set of bolded numbers, the number on the bottom is the product of the numbers on top.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!