-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsobnorm.m
More file actions
72 lines (48 loc) · 1.42 KB
/
sobnorm.m
File metadata and controls
72 lines (48 loc) · 1.42 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function I = sobnorm(y0, Map, Args)
%Calculates the sobolev norm using Spectral integration
N = length(y0)-1;
% arglength = length(Args);
% left = Args(arglength-1);
% right = Args(arglength);
% nn = 1001;
% xx = linspace(left,right, nn)';
% alpha = alphabeta(1);
% beta = alphabeta(2);
% args = [alpha, beta, -1, 1];
%args = [-1 1];
args = Args;
Steepness = 20;
[x, ~, ~] = Map(chebx(N), args);
A = 1/Steepness^4;
B = 1/Steepness^2; %Set up weights, not sure what to put here,
C = 1; % in the case of tanh(Nx), DDx increases N^2, so tried to account for that.
% IntM = baryM(x, xx);
%rho = tanh(Steepness*x);
% u = rho;
u = y0;
% uInt = IntM*u;
function w = weightfn(x)
% w = (1- x.^2).^(-1/2);
w = 1;
end
w = weightfn(x);
% wInt = weightfn(xx);
D = diffm(N, Map, args);
%D2 = ddiffm(N, Map, args);
D2 = D^2;
u_s = (D*u);
% u_sInt = IntM*u_s;
u_ss = (D2*u);
% u_ssInt = IntM*u_ss;
%plot(x, u,'.', x, B*u_s.^2, x, A*u_ss.^2)
Integrand = (A*(u_ss).^2 + B*u_s.^2 + C*u.^2);
Integrandw = w.*Integrand;
integrator = integw(N, Map, args);
%disp(Integrandw)
I = integrator*Integrandw(2:N+1);
% Integrand2 = (A*(u_ssInt).^2 + B*u_sInt.^2 + C*uInt.^2);
% Integrandw2 = wInt.*Integrand2;
% plot(xx, Integrandw2,'.', xx,A*(u_ssInt).^2,'.' , xx, B*u_sInt.^2, xx, C*uInt.^2);
% width = (right - left)/(nn-1);
% I2 = sum(Integrandw2(1:nn-1))*width;
end