1function phi = blending(phit, tau, tol)
2% BLENDING retrieves the blending function
3%
4% phi = blending(phit, tau, tol) gives the value of blending function, the
5% antiderivative of the window function 'phit' at a given value 'tau' to
6% an error tolerance 'tol'
8if nargin == 0, test_blending; return; end
10phi = zeros(length(tau),1);
11for i = 1:length(tau)
12 % can replace quadgk by integral (not sure which is better)
13 phi(i) = quadgk(phit,0, tau(i),'RelTol',tol,'AbsTol',tol);
14end
16phi = real(phi);
17end
19function test_blending
20tFinal = 1;
21Nt = 100;
22tol = 1e-12;
23b = log(1/tol);
24gam = 0.5;
25w = ceil(2*b/(pi*gam));
26t = linspace(0,tFinal,Nt); dt = t(2) - t(1);
27phit = window(dt,b,w);
28phi = blending(phit, t, tol);
29plot(t,phi, 'LineWidth',2);
30title('blending function \phi');
31xlabel('x'); ylabel('y');
32end