Mercurial > repos > public > sbplib
comparison +time/CdiffImplicit.m @ 380:280ae4dbf93b feature/beams
CdiffImplicit: Fixed a bug. Switched to LU.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 12 Dec 2016 11:35:23 +0100 |
parents | ca73ee0623e5 |
children | 151b08366d63 |
comparison
equal
deleted
inserted
replaced
379:ca73ee0623e5 | 380:280ae4dbf93b |
---|---|
34 if isempty(C) | 34 if isempty(C) |
35 C = sparse(m,m); | 35 C = sparse(m,m); |
36 end | 36 end |
37 | 37 |
38 if isempty(G) | 38 if isempty(G) |
39 G = @(t) sparse(m,m); | 39 G = @(t) sparse(m,1); |
40 end | 40 end |
41 | 41 |
42 if isempty(f1) | 42 if isempty(f1) |
43 f1 = sparse(m,m); | 43 f1 = sparse(m,m); |
44 end | 44 end |
94 t = obj.t; | 94 t = obj.t; |
95 end | 95 end |
96 | 96 |
97 function obj = step(obj) | 97 function obj = step(obj) |
98 b = obj.G(obj.t) - obj.BB*obj.v - obj.CC*obj.v_prev; | 98 b = obj.G(obj.t) - obj.BB*obj.v - obj.CC*obj.v_prev; |
99 obj.v_prev = obj.v; | |
99 | 100 |
100 % Backslash | 101 % % Backslash |
101 obj.v_prev = obj.v; | 102 % obj.v = obj.AA\b; |
102 obj.v = obj.AA\b; | |
103 | 103 |
104 % % LU with column pivot | 104 % LU with column pivot |
105 % y = obj.L\b(obj.p); | 105 y = obj.L\b(obj.p); |
106 % Qx = U\y; | 106 Qx = obj.U\y; |
107 % v = Qx(q); | 107 obj.v = Qx(obj.q); |
108 | 108 |
109 | 109 % Update time |
110 | |
111 obj.t = obj.t + obj.k; | 110 obj.t = obj.t + obj.k; |
112 obj.n = obj.n + 1; | 111 obj.n = obj.n + 1; |
113 end | 112 end |
114 end | 113 end |
115 end | 114 end |