METODO DOOLITLE:
>> a=[-3 2 5 7;2 -4 2 -5;3 2 -1 4;5 -1 2 3]
a=
-3 2 5 7
2 -4 2 -5
3 2 -1 4
5 -1 2 3
>> b=[3;2;-27;-36]
b=
-27
-36
>> x=a\b
x=
-5.0000
3.0000
2.0000
-4.0000
>> a1=[-3;2;3;5]
a1 =
-3
>> a2=[2;-4;2;-1]
a2 =
-4
-1
>> a3=[5;2;-1;2]
a3 =
-1
>> a4=[7;-5;4;3]
a4 =
-5
4
3
>> u1=a1
u1 =
-3
>> q1=u1/norm(u1)
q1 =
-0.4376
0.2917
0.4376
0.7293
RAIZ CUADRADA A1:
>> sqrt(47)
ans =
6.8557
>> u2=a2-(a2'*q1)*q1
u2 =
1.1702
-3.4468
2.8298
0.3830
>> q2=u2/norm(u2)
q2 =
0.2529
-0.7450
0.6117
0.0828
>> u3=a3-(a3'*q2)*q2-(a3'*q1)*q1
u3 =
4.9145
1.6700
-0.3340
2.4811
>> q3=u3/norm(u3)
q3 =
0.8528
0.2898
-0.0580
0.4305
>> u4=a4-(a4'*q3)*q3-(a4'*q2)*q2-(a4'*q1)*q1
u4 =
-0.0862
-0.3448
-0.4310
0.3448
>> q4=u4/norm(u4)
q4 =
-0.1313
-0.5252
-0.6565
0.5252
>> %calculo de matriz Q
>> Q=[q1 q2 q3 q4]
Q=
-0.4376 0.2529 0.8528 -0.1313
0.2917 -0.7450 0.2898 -0.5252
0.4376 0.6117 -0.0580 -0.6565
0.7293 0.0828 0.4305 0.5252
>> %calculo de la matriz r
>> r=Q'*a
r=
6.8557 -1.8962 -0.5835 -0.5835
0.0000 4.6265 -0.6714 8.1906
0.0000 -0.0000 5.7627 5.5805
-0.0000 0.0000 -0.0000 0.6565
>> %comprobacion
>> Q*r
ans =
-3.0000 2.0000 5.0000 7.0000
2.0000 -4.0000 2.0000 -5.0000
3.0000 2.0000 -1.0000 4.0000
5.0000 -1.0000 2.0000 3.0000
>>