/ concept-collection / windowedFourierProjection
Sign in
concept-collection / windowedFourierProjection
windowedFourierProjection / wfp_1Dspringscattering / prepForNextStep.m
27 lines · 859 BBlameHistoryRaw
1function [an,bn,sn,sn_hat] = prepForNextStep(anp1,bnp1,sn,sn_hat,snIdxNow,tgh,s,N,tol)
2% PREPFORNEXTSTEP prepares for the next step in the the time-stepping
3%
4% INPUTs:
5% anp1,bnp1: Fourier coefficients at new step and time derivative
6% sn, sn_hat: density grid function and transfrom
7% snIdxNow: index of density at the first time step
8% tgh: number of ghost points in time
9% s: location of sources
10% N: number of Fourier coefficients
11% tol: error tolerance
13% OUTPUTs:
14% an,bn: Fourier coefficients at the old step
15% sn,sn_hat: density grid function and transfrom
17% update values for the next time step
18an = anp1; bn = bnp1;
20% Update the density values for the next time-step
21for kk = 1:(tgh + 1)
22 sn(kk,:) = sn((kk+1),:);
23end
24sn_hat1 = finufft1d1(s,sn(snIdxNow,:)',1,tol,N,struct('modeord',1));
25sn_hat = [sn_hat1,sn_hat(:,1:(end-1))];
27end
moveopenescclose