Question

MATLAB: Do the following with the provided .m file (a) In the .m file, we have...

MATLAB:

Do the following with the provided .m file

(a) In the .m file, we have provided three questions. Make sure to answer them.

(b) Now on the MATLAB prompt, let us create any two 3 × 3 matrices and you can do the following:

X=magic(3);

Y=magic(3);

X*Y

matrixMultiplication3by3(X,Y)

(c) Now write a new function in MATLAB called matrixMultiplication that can multiply any two n × n matrix. You can safely assume that we will not test your program with matrices that do not have their inner dimensions matched up

CODE:

function [C] = matrixMultiplicationFor3by3(A,B)

%{

Question: What does b1, b2, and b3 contain?

%}

b1=B(:,1);

b2=B(:,2);

b3=B(:,3);

%{

Question: What does : when used in the

paranthesis do?

%}

a1=A(:,1);

a2=A(:,2);

a3=A(:,3);

%{

Question: The algorithm below to calculate

c1 and c2 and c3, is this the matrix multiplication

involving the column picture or the row picture?

Explain your answer clearly.

%}

c1=a1*b1(1)+a2*b1(2)+a3*b1(3);

c2=a1*b2(1)+a2*b2(2)+a3*b2(3);

c3=a1*b3(1)+a2*b3(2)+a3*b3(3);

C=[c1 c2 c3];

Homework Answers

Answer #1

1) here b1 b2 and b3 denote 1st column,2nd column and 3 rd column respectively as the row is not specified it can take any values.

2) : used in the paranthesis means that the particular field of the matrix can take any values,starting from the start of the particular field to the end of the field.Here field can be row or column.

3)The matrix multiplication here is involving the column picture as the matrix a and b are column matrix and c1 c2 and c3 is obtained by multiplying each element of the column a1 with first element of the column matrix b1 and a2 with 2nd element of the column matrix b1 and a3 with the 3rd element of the column matrix b1,similarly for c2 and c3.

and finally C is formed by combining c1 c2 and c3.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
MATLAB: Do the following with the provided .m file (a) In the .m file, we have...
MATLAB: Do the following with the provided .m file (a) In the .m file, we have provided three questions. Make sure to answer them. (b) Now on the MATLAB prompt, let us create any two 3 × 3 matrices and you can do the following: X=magic(3); Y=magic(3); X*Y matrixMultiplication3by3(X,Y) (c) Now write a new function in MATLAB called matrixMultiplication that can multiply any two n × n matrix. You can safely assume that we will not test your program with...
If the determinant of the 3x3 matrix [2c1 -2c2 2c3; a1+6c1 -a2-6c2 a3+6c3; -b1 b2 -b3]...
If the determinant of the 3x3 matrix [2c1 -2c2 2c3; a1+6c1 -a2-6c2 a3+6c3; -b1 b2 -b3] is -16, what is the determinant of the 3x3 matrix [a1 b1 c1; a2 b2 c2; a3 b3 c3]?
Given the following system of equations: a1x1 + b1x2 + c1x3 = d1 a2x1 + b2x2...
Given the following system of equations: a1x1 + b1x2 + c1x3 = d1 a2x1 + b2x2 + c2x3 = d2 a3x1 + b3x2 + c3x3 = d3 Write a MATLAB program to find solutions for : x1, x2 and x3. For any value of a1, a2, a3, b1, b2, b3, c1, c2, c3, d1, d2 and d3. Your program must ask the user to enter at run time the coefficients of your systems.
Write a Python class Matrix which defines a two-by-two matrix with float entries as a Python...
Write a Python class Matrix which defines a two-by-two matrix with float entries as a Python object. The class Matrix has to be able to display the object on the screen when the print function is called, and it should include methods determinant(), trace(), inverse(), characteristic_polynomial(), and matrix_product(). Furthermore, a user should be able to multiply the matrix by a constant and be able to add and subtract two matrices using the usual symbols + and -. Use the following...
Assume that we have training data for texts with two words, w1 and w2, with two...
Assume that we have training data for texts with two words, w1 and w2, with two classes C1 and C2. From the training data we have estimated: P(w1|C1) = a1, P(w2|C1) = b1, P(C1) = c1 P(w1|C2) = a2, P(w2|C2) = b2, and P(C2) = c2 Given a document D with words {w1,w2,w1}, what is the formula giving the log-odds-ratio of the probability that document is classed as C1 to the probability that document is classed as C2 using the...
Explain why the set of vectors given in matrix form do not span R3 : a1...
Explain why the set of vectors given in matrix form do not span R3 : a1 b1 2a1 -3b1 a2 b2 2a2 -3b2 a3 b3 2a3 -3b3
Question (excel) 1. Add a worksheet to the file and call it Output. 2. In the...
Question (excel) 1. Add a worksheet to the file and call it Output. 2. In the Output sheet: a. enter first name in cell A1.     b. enter last name in cell B1. 3. Record a macro. Call your macro CIS308Exam3. Within your macro, do the following:      a. In cell C1, use a formula to concatenate A1 and B1 with a space in between     b. Stop recording. 4. Open your macro in Visual Basic edit mode. Copy your...
Suppose the initial conditions of the economy are characterized by the following equations. In this problem,...
Suppose the initial conditions of the economy are characterized by the following equations. In this problem, we assume that prices are fixed at 1 (the price index is 100 and when we deflate, we use 1.00) so that nominal wealth equals real wealth. 1) C = a0 + a1 (Y - T) + a2 (WSM) + a3 (WRE) + a4 (CC) + a5 (r) 1’) C = a0 + a1 (Y - 200) + a2 (10,000) + a3 (15,000) +...
Solve this signal problem. Suppose the output y[n] of a DT LTI system with input x[n]...
Solve this signal problem. Suppose the output y[n] of a DT LTI system with input x[n] is y[n-1] - 10/3y[n] + y[n+1] = x[n] The system is stable and the impulse response of h[n] = A1*(B1)^n*C1 + A2*(B2)^n*C2 is then, What is A1? What is B1? What is C1? What is A2? What is B2? What is C2?
Find the optimal strategies and the value of the game. Indicate whether it is a fair...
Find the optimal strategies and the value of the game. Indicate whether it is a fair or a strictly determinable game: b1 b2 b3 b4 a1 2 10 7 0 a2 3 4 9 -1 a3 -6 -3 11 -3 a4 8 5 -4 -5
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT