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.
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...
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
Find two linearly independent solutions of 2x2y′′−xy′+(−2x+1)y=0,x>0 of the form y1=xr1(1+a1x+a2x2+a3x3+⋯) y2=xr2(1+b1x+b2x2+b3x3+⋯) where r1>r2. Enter r1=...
Find two linearly independent solutions of 2x2y′′−xy′+(−2x+1)y=0,x>0 of the form y1=xr1(1+a1x+a2x2+a3x3+⋯) y2=xr2(1+b1x+b2x2+b3x3+⋯) where r1>r2. Enter r1= a1= a2= a3= r2= b1= b2= b3= Note: You can earn partial credit on this problem.
Consider the following two-person zero-sum game. Assume the two players have the same three strategy options....
Consider the following two-person zero-sum game. Assume the two players have the same three strategy options. The payoff table below shows the gains for Player A. Player B Player A Strategy b1 Strategy b2 Strategy b3 Strategy  a1   3 2 ?4 Strategy  a2 ?1 0   2 Strategy  a3   4 5 ?3 Is there an optimal pure strategy for this game? If so, what is it? If not, can the mixed-strategy probabilities be found algebraically? What is the value of the game?
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT