Question

A commonly used matrix operation in linea alpebrais matrix matrix multiplication. Write a script that reads a matrix M from t

matlab progam
0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE:

#a
M=input("Enter a 2X2 matrix::\n")

#b
dimensions=size(M)

#c
R1=M(1,:)
C1=M(:,1)
R2=M(2,:)
C2=M(:,2)

#d
P11= dot(R1,C1)

#e
P12=dot(R1,C2)
P21=dot(R2,C1)
P22=dot(R2,C2)

#f
P=[P11,P12;P21,P22]

Q=M*M

compare=P-Q

Sample Output::

Enter a 2X2 matrix::
[1,2;4,5]
M =

1 2
4 5

dimensions =

2 2

R1=

1 2

C1 =

1
4

R2 =

4 5

C2 =

2
5

P11 = 9
P12 = 12
P21 = 24
P22 = 33
P =

9 12
24 33

Q =

9 12
24 33

compare =

0 0
0 0

Add a comment
Know the answer?
Add Answer to:
matlab progam A commonly used matrix operation in linea alpebrais matrix matrix multiplication. Write a script...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question A matrix of dimensions m × n (an m-by-n matrix) is an ordered collection of m × n elemen...

    Question A matrix of dimensions m × n (an m-by-n matrix) is an ordered collection of m × n elements. which are called eernents (or components). The elements of an (m × n)-dimensional matrix A are denoted as a,, where 1im and1 S, symbolically, written as, A-a(1,1) S (i.j) S(m, ). Written in the familiar notation: 01,1 am Gm,n A3×3matrix The horizontal and vertical lines of entries in a matrix are called rows and columns, respectively A matrix with the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT