source: liacs/la/opdr5/uitwerking.m@ 312

Last change on this file since 312 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 1.1 KB
RevLine 
[2]1echo on
2% 1)
3% see cramermatrix.m
4
5% 2)
6% Matrix A
7A = [1, 2, 3;
8 4, 5, 6;
9 7, 8, 9; ];
10
11% 3)
12% Vector b
13b = [ 10; 11; 12];
14
15% 4)
16help cramermatrix
17
18% 5)
19% test werking cramermatrix voor i=1,2,3
20for i=1:3
21 cramermatrix(A,i,b)
22end
23
24% 6)
25% see cramer.m
26
27% 7)
28% resultatencheck met rref(Ab)
29Ab = [1, 2, 3, 10;
30 6, 5, 4, 11;
31 7, 9, 8, 12; ];
32% little trick to input into newly created cramer function
33cramer(Ab(:,1:3),Ab(:,4))
34rref(Ab)
35% klopt
36
37%
38% Permataties van rijen van een matrix
39%
40
41% 1)
42A = [ 1, 2, 3, 4;
43 5, 6, 7, 8;
44 9, 10, 11, 12;
45 13, 14, 15, 16; ];
46% 2)
47P4231 = [ 0, 0, 0, 1;
48 0, 1, 0, 0;
49 0, 0, 1, 0;
50 1, 0, 0, 0; ];
51
52% 3)
53T1 = P4231 * A
54
55% 4)
56T2 = rowswap(A,1,4)
57% Ze zijn gelijk
58
59%
60% LU deconpositie
61%
62
63% 1)
64A = [ 2, 4, -1, 5, -2;
65 -4, -5, 3, -8, 1;
66 2, -5, -4, 1, 8;
67 -6, 0, 7, -3, 1; ];
68
69% 2)
70[L, U] = lu(A)
71
72% 3) Nee L geen onderdriehoeksmatrix, en U geen bovendriehoeksmatrix
73
74% 4)
75[L, U, P] = lu(A)
76
77% 5) Ja, L is nu een onderdriehoeksmatrix
78
79% 6)
80[L, U] = lu(P * A)
81% Dit levert het gewenste resultaat op, als P gebruikt wordt
82
83
Note: See TracBrowser for help on using the repository browser.