% A hard screen with two apertures: Young's two-slit experiment, in sound. % % The screen is a vertical slab of thickness `thick` at x = 0, with two gaps % of width `gap` centred at y = +-sep/2 — all in metres. Its sound speed is % `cwall`, a ratio to the background `c0`; well above 1 it is nearly rigid, so % almost everything that does not go through a slit comes back. % % Drive it with the plane-wave source (the `point source` parameter at 0) and % the two apertures become two sources radiating into the right half-plane. % Where their paths differ by a whole wavelength they add; by half a % wavelength they cancel. The fringe spacing is set by sep/wavelength, so % raising the frequency packs the lobes closer together. function [c, sig] = medium(x, y, L, h, c0, cwall, gap, sep, thick) s = 1.5*h; inslab = 0.5 * (1 - tanh((abs(x) - thick/2) / s)); inslit = 0.5 * (1 - tanh((abs(abs(y) - sep/2) - gap/2) / s)); wall = inslab .* (1 - inslit); c = c0 * (1 + (cwall - 1) * wall); sig = sponge(x, y, L, 0.2*L, 1700); end