-
Notifications
You must be signed in to change notification settings - Fork 1
/
prima.m
48 lines (37 loc) · 2.14 KB
/
prima.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Demonstrate my QR test case in Octave
format long g
# The first two steps of Prima for my basic test case
G= [
0.01, -0.01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0;
-0.01, 0.012, -0.002, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
0, -0.002, 0.004, -0.002, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
0, 0, -0.002, 0.004, -0.002, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
0, 0, 0, -0.002, 0.004, -0.002, 0, 0, 0, 0, 0, 0, 0, 0, 0;
0, 0, 0, 0, -0.002, 0.002, 0, 0, 0, 0, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0, 0.01, -0.01, 0, 0, 0, 0, 0, 1, 0;
0, 0, 0, 0, 0, 0, -0.01, 0.012, -0.002, 0, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0, 0, -0.002, 0.004, -0.002, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0, 0, 0, -0.002, 0.004, -0.002, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0, 0, 0, 0, -0.002, 0.004, -0.002, 0, 0, 0;
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.002, 0.002, 0, 0, 1;
-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0]
B = [ 0, 0, 0;
0, 0, 0;
0, 0, 0;
0, 0, 0;
0, 0, 0;
0, 0, 0;
0, 0, 0;
0, 0, 0;
0, 0, 0;
0, 0, 0;
0, 0, 0;
0, 0, 0;
-1, 0, 0;
0, -1, 0;
0, 0, -1]
A = sparse(G) \ sparse(B)
[Q, R] = qr(A)
Q*eye(15,3)