Advanced Octave A43 — Irregular sampling and gaps
Advanced GNU Octave with GX-TXT · Module 08
Before applying an algorithm designed for equidistant samples, we control time distances. A long range can indicate a gap and requires an explicit decision on how to treat it.
Objectives and prerequisites
We use the Synthetic Dataset octave_advanced_sensor of lesson A07 and canonical reading seen in module 02. The test uses GX-TXT dev112-P011-bis and GNU Octave 9.4.0. Import lacune.m, register it and run it in the Runner. The octave_advanced_resampled result uses a created-only ID: to repeat the test, use a new Session or change the ID in the script.
Diagnosing distances
We read the 11 original samples between 0 and 5 s, then we intentionally exclude those at 1.5 and 2 s to simulate a gap. diff(ti) calculates the intervals between the remaining 9 samples; the statistics NUMERIC_API_v1 ZXZ ZXQ function calculates the average.
The test detects a minimum step of 0.50 s, a maximum of 1.50 s and an average of 0.625 s. A range exceeds the nominal pitch of 0.5 seconds. With real data, a comparison threshold should take into account the temporal accuracy and possible jitter: here the times are synthetic and the threshold is exact.
Sample without inventing observations
interp1 calculates linear values on the regular grid 0:0,5:5, inside the observed range. In the execution we get 1,575 V to 1.5 s and 1,700 V to 2 s. The script publishes the result as a separate Dataset, preserving the distinction from the source.
These values are estimates according to a linear rule, not new measures. The presence of a gap could hide oscillations or rapid events: the linear connection is not able to reconstruct them. In a real analysis it documents the size of the gaps, the method and the possible maximum allowed interval; it also evaluates whether to exclude the tract instead of interpolating it.
Exercise
- How many observed samples remain after the simulated removal?
- What indicates the range of 1.5 seconds?
- Is an interpolated value equivalent to an acquired measure?
Worked solution
- Nine.
- There is a jump between two consecutive samples longer than the nominal pitch; in this example there are intentionally two positions.
- No: It depends on the chosen method and does not guarantee to recover what happened in the gap.
Other steps of this project
- Advanced Octave A75 — Dynamical systems in phase space
- Advanced Octave A81 — Geography of the waves and a 3D surface
- Advanced Octave A82 — Age, sex and demographic inequalities
- Advanced Octave A83 — All-cause mortality, certified COVID deaths and surveillance
- Advanced Octave A84 — A reproducible public account
- Advanced Octave A73 — Optimization landscapes and 3D trajectories