1% A minimal chaotic system: two beads on a short string, pinned at both
2% ends, free to move in 3D (6 degrees of freedom). Struck hard and
3% off-axis, the motion is chaotic: turn on "perturbed twin" to run it again
4% with the strike changed by one part in 1e9 and watch the two runs
5% separate exponentially until they are unrelated. Scale the strike down
6% (try 0.05) and the motion is regular: the separation grows only slowly.
7%
8% Transverse modes at small amplitude: sqrt(f0/(m*a))/(2*pi) * [1, sqrt(3)]
9% = 159 and 276 Hz.
11a = 0.01; % bead spacing (m)
12m = 1e-4; % bead mass (kg)
13f0 = 1; % string tension (N)
14strain = 0.05; % spring stretch at rest
16[pos, E] = bp_chain(4, 3 * a);
17sys.pos = pos;
18sys.mass = m;
19sys.pinned = [1 4];
20sys.springs = bp_springs(pos, E, f0 / (strain * a), f0);
21% light damping: every mode falls 60 dB in 60 s
22[sys.friction, sys.dashpots] = bp_decay(pos, sys.mass, sys.springs, [200 60]);
24s = 1; % strike strength; try 0.05 for regular motion
25hit.beads = 2;
26hit.velocity = s * [6 3 20]; % m/s, off-axis
27sys.hits = hit;
29sys.listen = struct('beads', 3, 'dir', [0 0 1]);
30sys.duration = 3;
31sys.dt = 1 / (48000 * 8); % the automatic step is set at rest; the hard strike
32 % needs a finer one to keep energy drift small