// The shared .m files, shown read-only. The editable script in each lab is // the filter itself; these are the pieces every lab is allowed to assume. import { useState } from 'react' const raw = import.meta.glob('../matlab/*.m', { query: '?raw', import: 'default', eager: true }) as Record< string, string > const FILES = Object.entries(raw) .map(([path, content]) => ({ name: path.slice(path.lastIndexOf('/') + 1), content })) .sort((a, b) => a.name.localeCompare(b.name)) export default function LibraryView() { const [open, setOpen] = useState(FILES[0]?.name ?? null) return (
Reference

The shared MATLAB library

Every lab boots with these function files in its session, alongside the editable script and a driver that reads the controls, computes the exact answer, measures the method against it, and writes the figures and the sound. They are the pieces that would otherwise be repeated in every chapter: reading and writing the page's data, packing a signal for the audio player, the spectral estimates, the Bessel zeros, and the one routine that every measured frequency in the tutorial comes from.

{FILES.map((f) => (
{open === f.name &&
{f.content}
}
))}
) }