You are on page 1of 2

12/8/16 12:37 AM MATLAB Command Window 1 of 2

>> format long


>> A=[6,-1,0,-5,0,0,0;2,-9,5,0,2,0,0;0,1,-3,0,0,2,0;2,0,0,-5,2,0,1;
0,1,0,5,-12,1,0;0,0,10,0,2,-17,0;0,0,0,1,0,0,-2]

A =

6 -1 0 -5 0 0 0
2 -9 5 0 2 0 0
0 1 -3 0 0 2 0
2 0 0 -5 2 0 1
0 1 0 5 -12 1 0
0 0 10 0 2 -17 0
0 0 0 1 0 0 -2

>> b=[0,0,0,0,-45,-45,-9]'

b =

0
0
0
0
-45
-45
-9

>> x=A\b

x =

8.999999999999998
8.999999999999996
8.999999999999996
8.999999999999996
8.999999999999998
8.999999999999998
8.999999999999996

>> r=A*x-b

r =
12/8/16 12:37 AM MATLAB Command Window 2 of 2

1.0e-013 *

0
0.106581410364015
0.035527136788005
0.035527136788005
0.142108547152020
0
0.035527136788005

>> K=cond(A,2)

K =

33.962445800706057

>>

You might also like