/ concept-collection / windowedFourierProjection
Sign in
concept-collection / windowedFourierProjection
windowedFourierProjection / wfp_1Dspringscattering / get_uHistory.m
28 lines · 775 BBlameHistoryRaw
1function uh = get_uHistory(an,x,tol)
2% GET_UHISTORY computes the history part of the solution
3%
4% uh = get_uHistory(an,x,K)
5% computes the history part of the numerical solution, given Fourier
6% modes 'an', 'x' grid points
8%%% Using Finufft (NU to NU)
9% uh = (1/(2*pi))*finufft1d3(K,an,-1,tol,x);
11%%% Using Finufft (U to NU)
12opts.modeord = 1;
13uh = (1/(2*pi))*finufft1d2(x,-1,tol,an,opts);
15% Did not use fft because number of test points is small. We are using here
16% N frequencies to compute Nx values where Nx<N. The fft operator truncates
17% at Nx frequencies, which produces incorrect results.
19%%% Standard if missing Finufft
20% uh = zeros(size(x));
21% cnt = 1;
22% for k = K
23% uh = uh + an(cnt)*exp(-1i*k*x);
24% cnt = cnt + 1;
25% end
26% uh = (1/(2*pi))*uh;
28end
moveopenescclose