Use one MATLAB statement to generate each of the following s

Use one MATLAB statement to generate each of the following scalars, vectors, and matrices, where these parts are sequential. Include the output in each part. Generate A = (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16) directly by entering each element. Generate A by using the reshape function Calculate B = A^2. Generate x = (1, 2, 3, 4)^T Calculate Ax, x^T A, and x^T Ax Calculate AB and BA. Generate the matrix C whose elements are the squares of the elements of A. Calculate AC and CA. Calculate Ax + 3x. Calculate (A + 3I)x. Creating and Using Arrays Let J element R^4 times 4 have all of its elements 1. Calculate Ax + 3x and Ax + 3Jx. Analytically, are they the same?

Solution

a) A = [1,2,3,4; 5,6,7,8; 9,10,11,12; 13,14,15,16];

b) A = reshape(A,4,4);

c) B = A * A ;

d) x = transpose([1,2,3,4]);

e) Ax = A * x;
xTA = transpose(x) * A;
xTAx = transpose(x) * A * x;

f) AB = A * B ;
BA = B * A ;

g) C = A.*A

h) AC = A * C
CA = C * A

i) Ax_3x = A * x + 3.*A

j) I = eye(4)
A_3I_x = (A + 3.*I) * x

k) P = A * x + 3.*x
J = ones(4)
Q = A * x + 3.*J * x

 Use one MATLAB statement to generate each of the following scalars, vectors, and matrices, where these parts are sequential. Include the output in each part. G

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site