H=hilb(5)
H =
1.0000 0.5000 0.3333 0.2500 0.2000
0.5000 0.3333 0.2500 0.2000 0.1667
0.3333 0.2500 0.2000 0.1667 0.1429
0.2500 0.2000 0.1667 0.1429 0.1250
0.2000 0.1667 0.1429 0.1250 0.1111
cond(H)
ans =
4.7661e+05
H=hilb(10)
H =
Columns 1 through 9
1.0000 0.5000 0.3333 0.2500 0.2000 0.1667 0.1429 0.1250 0.1111
0.5000 0.3333 0.2500 0.2000 0.1667 0.1429 0.1250 0.1111 0.1000
0.3333 0.2500 0.2000 0.1667 0.1429 0.1250 0.1111 0.1000 0.0909
0.2500 0.2000 0.1667 0.1429 0.1250 0.1111 0.1000 0.0909 0.0833
0.2000 0.1667 0.1429 0.1250 0.1111 0.1000 0.0909 0.0833 0.0769
0.1667 0.1429 0.1250 0.1111 0.1000 0.0909 0.0833 0.0769 0.0714
0.1429 0.1250 0.1111 0.1000 0.0909 0.0833 0.0769 0.0714 0.0667
0.1250 0.1111 0.1000 0.0909 0.0833 0.0769 0.0714 0.0667 0.0625
0.1111 0.1000 0.0909 0.0833 0.0769 0.0714 0.0667 0.0625 0.0588
0.1000 0.0909 0.0833 0.0769 0.0714 0.0667 0.0625 0.0588 0.0556
Column 10
0.1000
0.0909
0.0833
0.0769
0.0714
0.0667
0.0625
0.0588
0.0556
0.0526
cond(H)
ans =
1.6025e+13
x_true = ones(10,1)
x_true =
1
1
1
1
1
1
1
1
1
1
b = H*x_true
b =
2.9290
2.0199
1.6032
1.3468
1.1682
1.0349
0.9307
0.8467
0.7773
0.7188
x = H\b
x =
1.0000
1.0000
1.0000
1.0000
0.9999
1.0003
0.9995
1.0005
0.9997
1.0001
cond(H)
ans =
1.6025e+13
H*x
ans =
2.9290
2.0199
1.6032
1.3468
1.1682
1.0349
0.9307
0.8467
0.7773
0.7188
(H*x-b)
ans =
1.0e-15 *
0.4441
0.4441
0.2220
0
0.4441
0.2220
0.1110
0
-0.1110
0.1110
b
b =
2.9290
2.0199
1.6032
1.3468
1.1682
1.0349
0.9307
0.8467
0.7773
0.7188
b_prime = H*x
b_prime =
2.9290
2.0199
1.6032
1.3468
1.1682
1.0349
0.9307
0.8467
0.7773
0.7188
A = [1e-20 1; 1 1;]
A =
0.0000 1.0000
1.0000 1.0000
x_true = [1;1]
x_true =
1
1
b=A*x
{Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first
matrix matches the number of rows in the second matrix. To perform elementwise multiplication,
use '.*'.
}
b=A*x_true
b =
1
2
help mylu
mylu is a function.
[L, U] = mylu(A)
[L,U] = mylu(A)
{'rows' requires Database Toolbox.
Error in mylu (line 2)
n=rows(A);
}
diary