/ concept-collection / windowedFourierProjection
Sign in
concept-collection / windowedFourierProjection
windowedFourierProjection / wfp_1Dspringscattering / get_uIncidentInfo.m
50 lines · 1.2 KBBlameHistoryRaw
1function [dt0,dataParam] = get_uIncidentInfo(dataParam)
2% GET_UINCIDENTINFO prepares information needed for an incident wave of the
3% form uin = exp(-mu*(x - t - t0).^2);
4%
5% INPUT:
6% tFinal: final time
7% tol: error tolerance for the full problem (to compute starting dt)
8% gam: pad gam*Nyquist for window function (to compute starting dt)
9%
10% OUTPUT:
11% mu,t0 as indicated above
12% Nt0: number of initial time steps to resolve incident pulse
13% h0: minimum step size to resolve incident pulse
14% dataParam: is struct to hold mu and t0 (for ease of switching between
15% types of test solutions
17if nargin == 0, test_get_uIncidentInfo(); return; end
19mu = dataParam.mu;
20t0 = dataParam.t0;
22if(isnan(t0))
23 t0 = -sqrt(log(1/eps)./mu);
24end
26% choose the initial time step
27dt0 = pi/(4*sqrt(mu*log(1/eps)));
29if(isfield(dataParam,'doubleTimeStep'))
30 if(dataParam.doubleTimeStep == 1)
31 dt0 = 2*dt0;
32 end
33end
35dataParam.t0 = t0;
37end
39function test_get_uIncidentInfo()
41mu = 5;
42[dt0,dataParam] = get_uIncidentInfo(mu);
44x = linspace(-pi,pi,1000); t = linspace(0,3*pi,1000); t0 = dataParam.t0;
45uin = get_uIncident(x,t,mu,t0);
47figure(1)
48imagesc(x,t,uin);
50end
moveopenescclose