Mercurial > repos > public > sbplib
comparison spdiagVariable.m @ 681:7368affc8f78 feature/poroelastic
Add D2 variable periodic for second order.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Wed, 07 Feb 2018 15:42:50 -0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
680:cd1a76c38565 | 681:7368affc8f78 |
---|---|
1 function A = spdiagVariable(a,i) | |
2 default_arg('i',0); | |
3 | |
4 if isrow(a) | |
5 a = a'; | |
6 end | |
7 | |
8 n = length(a)+abs(i); | |
9 | |
10 if i > 0 | |
11 a = [sparse(i,1); a]; | |
12 elseif i < 0 | |
13 a = [a; sparse(abs(i),1)]; | |
14 end | |
15 | |
16 A = spdiags(a,i,n,n); | |
17 end |