function result = plate_rr_strike(params, M) % PLATE_RR_STRIKE Strike the Rayleigh-Ritz modes and render the result. % % result = plate_rr_strike(params, M) takes the modes of plate_rr_modes, % evaluates the basis at the strike point and the probe (the hit % participation of each mode is its mass-normalized shape there), sets the % modal damping (plate_damping), applies the prescribed Hertz pulse % (plate_rr_contact) and synthesizes the sound, the series and the frames % (plate_synthesize). Only this function needs to run again when the % hammer, the strike point, the microphone or the render settings change. t_start = tic; if ~strcmp(M.method, 'rr') error('plate_rr_strike: the modes were computed by another method (%s)', M.method); end P = plate_setup(params); pl = params.plate; if abs(params.strike.x) > pl.width / 2 || abs(params.strike.y) > pl.height / 2 error('plate_rr_strike: the strike point is outside the plate'); end if abs(params.probe.x) > pl.width / 2 || abs(params.probe.y) > pl.height / 2 error('plate_rr_strike: the probe is outside the plate'); end hit = plate_rr_basis(params.strike.x, params.strike.y, M.order, pl.width, pl.height); phi_hit = (M.vecs' * hit)'; [zeta, Q] = plate_damping(M.freqs, M.support_part, params, P); fs = params.render.fs; na = round(params.render.duration * fs); t = (0:na - 1) / fs; C = plate_rr_contact(params, P, M.freqs, zeta, phi_hit, t); [bp, bxx, byy, bxy] = plate_rr_basis(params.probe.x, params.probe.y, M.order, pl.width, pl.height); D.zeta = zeta; D.Q = Q; D.phi_hit = phi_hit; D.phi_probe = (M.vecs' * bp)'; D.kxx_probe = (M.vecs' * bxx)'; D.kyy_probe = (M.vecs' * byy)'; D.kxy_probe = (M.vecs' * bxy)'; result = plate_synthesize(params, P, M, C, D); result.info.strike_wall_s = toc(t_start); end