This is a Classroom License for instructional use only.
Research and commercial use is prohibited.
To get started, select "MATLAB Help" from the Help menu.
>> A=[-3 4 1 -2;2 -1 3 5;5 -5 2 7; 4 7 5 1]
A =
-3 4 1 -2
2 -1 3 5
5 -5 2 7
4 7 5 1
>> b=[0 5 1 3]
b =
0 5 1 3
>> b=[0;5;1;3]
b =
0
5
1
3
>> d=det(A)
d =
0
>> A=[-3 0 1 -2;2 -1 3 5;5 -5 2 7; 4 7 5 1]
A =
-3 0 1 -2
2 -1 3 5
5 -5 2 7
4 7 5 1
>> d=det(A)
d =
352
>> X=A/B
??? Undefined function or variable 'B'.
>> X=A/b
??? Error using ==> /
Matrix dimensions must agree.
>> X=A\b
X =
-1.2500
1.0000
-0.1591
1.7955
>> A*X
ans =
-0.0000
5.0000
1.0000
3.0000
>> C=A'
C =
-3 2 5 4
0 -1 -5 7
1 3 2 5
-2 5 7 1
>> inv(A)
ans =
0 -0.3750 0.2500 0.1250
-0.2500 0.2500 -0.2500 -0.0000
0.4091 -0.1477 0.2045 0.1250
-0.2955 0.4886 -0.2727 -0.1250
>> inv(A)*X
ans =
-0.1903
0.6023
-0.4672
0.6769
>> inv(A)*B
??? Undefined function or variable 'B'.
>> inv(A)*b
ans =
-1.2500
1.0000
-0.1591
1.7955
>> A(1:2,1:3)
ans =
-3 0 1
2 -1 3
>> A(1:2,1:3)=0
A =
0 0 0 -2
0 0 0 5
5 -5 2 7
4 7 5 1
>> eye(4)
ans =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
>> N=eye(4)
N =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
>> M=A*inv(A)
Warning: Matrix is singular to working precision.
M =
NaN NaN NaN NaN
NaN NaN NaN NaN
NaN NaN NaN NaN
Inf Inf Inf Inf
>> A=[-3 4 1 -2;2 -1 3 5;5 -5 2 7; 4 7 5 1]
A =
-3 4 1 -2
2 -1 3 5
5 -5 2 7
4 7 5 1
>> M=A*inv(A)
Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 8.085658e-018.
M =
0 0.5000 -1.0000 0.0511
0 0 2.0000 0.0966
2.0000 0 2.0000 0.0455
1.7500 2.0000 -2.0000 1.1989
>> A=[-3 4 1 -2;2 -1 3 5;5 -5 2 7; 4 7 5 1]
A =
-3 4 1 -2
2 -1 3 5
5 -5 2 7
4 7 5 1
>> inv(A)
Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 8.085658e-018.
ans =
1.0e+015 *
-0.0000 -0.0000 0.0000 0.0000
1.9054 -1.9054 1.9054 0.0000
-3.1179 3.1179 -3.1179 -0.0000
2.2518 -2.2518 2.2518 0.0000
>> M==N
ans =
0 0 0 0
1 0 0 0
0 1 0 0
0 0 0 0
>> M&N
ans =
0 0 0 0
0 0 0 0
0 0 1 0
0 0 0 1
>>