This question is intended for MATLAB The only rule is no har

This question is intended for MATLAB. The only rule is no hardwiring the answer in MATLAB.

Given a vector of length m and that m is the product of two positive integers, p and n, produce a p by n matrix whose elements are from Vic but arranged in a very special way. Here are two examples. For a given vector with elements: 12 3 8 2 10 7 4 9 1 11 6 5 and length m = 12, the resulting matrix for p = 4 and n = 3 has elements 12 3 8 2 10 7 4 9 1 11 6 5 This can be done in a few steps using linear indexing of a matrix together with the transpose operation. If written correctly, your program should work if the given vector is either a row or column vector.

Solution

To convert vector to matrix you have to use vec2mat() function.

You only need to know the column size of the matrix.

If you know m

and p then you have to apply simply this : vec2mac(vec,p)

and if you know only n then you have to apply : vec2mac(vec,m/n)

Example :

It will be padded if your vector does not have sufficient elements as matrix suppose last last example you have m = 11 and done this

So the last element of the matrix will be padded as 0;

This question is intended for MATLAB. The only rule is no hardwiring the answer in MATLAB. Given a vector of length m and that m is the product of two positive

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site