comparison +sbp/+implementations/d1_gauss_4.m @ 431:5f4540e13f9b feature/quantumTriangles

Meged with default
author Ylva Rydin <ylva.rydin@telia.com>
date Wed, 08 Feb 2017 09:18:08 +0100
parents 42c4f0b545d6
children 0bc37a25ed88
comparison
equal deleted inserted replaced
430:25053554524b 431:5f4540e13f9b
1 function [D1,H,x,h,e_l,e_r] = d1_gauss_4(L)
2
3 % L: Domain length
4 % N: Number of grid points
5 if(nargin < 2)
6 L = 1;
7 end
8
9 N = 4;
10
11 % Quadrature nodes on interval [-1, 1]
12 x = [ -0.8611363115940526; -0.3399810435848563; 0.3399810435848563; 0.8611363115940526];
13
14 % Shift nodes to [0,L]
15 x = (x+1)/2*L;
16
17 % Boundary extrapolation operators
18 e_l = [1.5267881254572668; -0.8136324494869273; 0.4007615203116504; -0.1139171962819899];
19 e_r = flipud(e_l);
20 e_l = sparse(e_l);
21 e_r = sparse(e_r);
22
23 %%%% Compute approximate h %%%%%%%%%%
24 h = L/(N-1);
25 %%%%%%%%%%%%%%%%%%%%%%%%%
26
27 %%%% Norm matrix on [-1,1] %%%%%%%%
28 P = sparse(N,N);
29 P(1,1) = 0.3478548451374539;
30 P(2,2) = 0.6521451548625461;
31 P(3,3) = 0.6521451548625461;
32 P(4,4) = 0.3478548451374539;
33 %%%%%%%%%%%%%%%%%%%%%%%%%
34
35 %%%% Norm matrix on [0,L] %%%%%%%%
36 H = P*L/2;
37 %%%%%%%%%%%%%%%%%%%%%%%%%
38
39 %%%% D1 on [-1,1] %%%%%%%%
40 D1 = sparse(N,N);
41 D1(1,1) = -3.3320002363522817;
42 D1(1,2) = 4.8601544156851962;
43 D1(1,3) = -2.1087823484951789;
44 D1(1,4) = 0.5806281691622644;
45
46 D1(2,1) = -0.7575576147992339;
47 D1(2,2) = -0.3844143922232086;
48 D1(2,3) = 1.4706702312807167;
49 D1(2,4) = -0.3286982242582743;
50
51 D1(3,1) = 0.3286982242582743;
52 D1(3,2) = -1.4706702312807167;
53 D1(3,3) = 0.3844143922232086;
54 D1(3,4) = 0.7575576147992339;
55
56 D1(4,1) = -0.5806281691622644;
57 D1(4,2) = 2.1087823484951789;
58 D1(4,3) = -4.8601544156851962;
59 D1(4,4) = 3.3320002363522817;
60 %%%%%%%%%%%%%%%%%%%%%%%%%
61
62 % D1 on [0,L]
63 D1 = D1*2/L;