Mercurial > repos > public > sbplib
comparison +time/Cdiff.m @ 820:501750fbbfdb
Merge with feature/grids
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 07 Sep 2018 14:40:58 +0200 |
parents | 151ab2b5a686 |
children | 8894e9c49e40 c9009d5a3101 |
comparison
equal
deleted
inserted
replaced
819:fdf0ef9150f4 | 820:501750fbbfdb |
---|---|
10 n | 10 n |
11 end | 11 end |
12 | 12 |
13 | 13 |
14 methods | 14 methods |
15 % Solves u_tt = Du + Eu_t + S | |
16 % D, E, S can either all be constants or all be function handles, | |
17 % They can also be omitted by setting them equal to the empty matrix. | |
18 % Cdiff(D, E, S, k, t0, n0, v, v_prev) | |
15 function obj = Cdiff(D, E, S, k, t0, n0, v, v_prev) | 19 function obj = Cdiff(D, E, S, k, t0, n0, v, v_prev) |
16 % Cdiff(D, E, S, k, t0, n0, v, v_prev) | 20 m = length(v); |
17 m = size(D,1); | |
18 default_arg('E',sparse(m,m)); | 21 default_arg('E',sparse(m,m)); |
19 default_arg('S',sparse(m,1)); | 22 default_arg('S',sparse(m,1)); |
20 | |
21 if ~(issparse(D) && issparse(E) && issparse(S)) | |
22 warning('One of the matrices D, E, S is not sparse!') | |
23 print_issparse(D) | |
24 print_issparse(E) | |
25 print_issparse(S) | |
26 end | |
27 | 23 |
28 obj.D = D; | 24 obj.D = D; |
29 obj.E = E; | 25 obj.E = E; |
30 obj.S = S; | 26 obj.S = S; |
27 | |
28 | |
31 obj.k = k; | 29 obj.k = k; |
32 obj.t = t0; | 30 obj.t = t0; |
33 obj.n = n0; | 31 obj.n = n0; |
34 obj.v = v; | 32 obj.v = v; |
35 obj.v_prev = v_prev; | 33 obj.v_prev = v_prev; |