0% found this document useful (0 votes)
40 views2 pages

HW 1

The document shows the steps to solve a system of linear equations Ax=b. A matrix P is defined and a matrix Bf is given. The inverse of Bf, denoted inv, is calculated. When trying to solve the system by computing inv*P or P*inv, an error occurs due to mismatched matrix dimensions. Computing inv*P instead provides the solution vector final.

Uploaded by

karanbir123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views2 pages

HW 1

The document shows the steps to solve a system of linear equations Ax=b. A matrix P is defined and a matrix Bf is given. The inverse of Bf, denoted inv, is calculated. When trying to solve the system by computing inv*P or P*inv, an error occurs due to mismatched matrix dimensions. Computing inv*P instead provides the solution vector final.

Uploaded by

karanbir123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MATLAB Command Window Page 1

>> clear
>> HW1

P =

0
5
0
0
15
-10
0
0
0
0
-5
0

Bf =

1.0000 0 0 0 0 0 0 0
0 0 0 0
0 0.1000 0.1000 0 0 0 0 0
0 0 0 0
0 1.0000 0 0 0 0 0 0
0 0 0 0
0 0 1.0000 0 1.0000 0 0 0
0 0 0 0
0 0 0 1.0000 0 0 -1.0000 0
0 0 0 0
0 0 0 0 -0.0667 -0.0667 0 0.0667
0.0667 0 0 0
0 0 0 0 0 1.0000 0 1.0000
0 0 0 0
0 0 0 0 0 0 1.0000 0
0 -1.0000 0 0
0 0 0 0 0 0 0 0
1.0000 0 1.0000 0
0 0 0 0 0 0 0 0
0 1.0000 0 0
0 0 0 0 0 0 0 0
0 0 -0.1000 -0.1000
0 0 0 0 0 0 0 0
0 0 0 1.0000

>> inv = inv(Bf)

inv =
MATLAB Command Window Page 2

1.0000 0 0 0 0 0 0 0
0 0 0 0
0 0 1.0000 0 0 0 0 0
0 0 0 0
0 10.0000 -1.0000 -0.0000 0 0 0 0
0 0 0 0
0 0 0 0 1.0000 0 0 1.0000
0 1.0000 0 0
0 -10.0000 1.0000 1.0000 0 0 0 0
0 0 0 0
0 5.0000 -0.5000 -0.5000 0 -7.5000 0.5000 0
0.5000 0 5.0000 0.5000
0 0 0 0 0 0 0 1.0000
0 1.0000 0 0
0 -5.0000 0.5000 0.5000 0 7.5000 0.5000 0
-0.5000 0 -5.0000 -0.5000
0 0 0 0 0 0 0 0
1.0000 0 10.0000 1.0000
0 0 0 0 0 0 0 0
0 1.0000 0 0
0 0 0 0 0 0 0 0
0 0 -10.0000 -1.0000
0 0 0 0 0 0 0 0
0 0 0 1.0000

>> final = P*inv


Error using *
Inner matrix dimensions must agree.

>> final = inv*P

final =

0
0
50
15
-50
75
0
-75
-50
0
50
0

>>

You might also like