% Validate against woodblock.py reference diagnostics (its defaults use % mallet_stiffness = 3.0e8) and the listener targets in woodblock.md ยง7. % Run with: numbl run woodblock_validate.m P = woodblock_defaults(); P.mallet_stiffness = 3.0e8; [y, basis, dinfo] = woodblock_render(P); fprintf('reference config:\n'); fprintf(' contact %.3f ms (target 0.301), peak %.0f N (target 794)\n', ... dinfo.contactMs, dinfo.peakForceN); fprintf(' peak %.3f Pa (target 6.132), %.1f dB SPL (target 109.7)\n', ... dinfo.peakPa, dinfo.peakSplDb); fprintf(' max real eigenvalue: %.1f (must be < 0)\n', dinfo.maxRealLam); targets = [0.15 0.25 0.30 109.7 0.00 0.00 0.40 100.9 0.00 0.40 0.00 90.9 0.00 0.05 0.02 125.4]; for i = 1:size(targets, 1) Q = P; Q.listener_x_m = targets(i, 1); Q.listener_y_m = targets(i, 2); Q.listener_z_m = targets(i, 3); [~, ~, di] = woodblock_render(Q); err = abs(di.peakSplDb - targets(i, 4)); if err < 0.3 verdict = 'ok'; else verdict = 'MISMATCH'; end fprintf('listener (%.2f, %.2f, %.2f): %.1f dB SPL (target %.1f) %s\n', ... targets(i, 1), targets(i, 2), targets(i, 3), di.peakSplDb, targets(i, 4), verdict); end