Advanced Octave A62 — Typed parameters and configuration
Advanced GNU Octave with GX-TXT · Module 11
An explicit configuration makes an analysis repeatable and allows you to identify incompatible parameters before producing results. We compare two scenarios with the same sampling frequency.
Objectives and prerequisites
We repeat gxtxt_context of A06 and sampling of A43. The test uses GX-TXT dev112-P011-bis and GNU Octave 9.4.0. Import configurazioni.m, register it and run it in the Runner.
Declare and verify
gxtxt_parameter_declare declares sample_rate as double, with default value 100 Hz and minimum 1 Hz. gxtxt_context() provides the actual value to the script. Two structures define scenarios at 2 and 8 Hz. Before calculating both, the program checks that each frequency is strictly less than half of the sampling frequency: if a configuration does not meet the condition, it signals an error before producing the summary of the scenarios.
This test controls the Nyquist condition for synthetic sinusoids of the example; it does not replace the evaluation of antialias filters and spectral content of a real signal.
With the default value, the test produces 100 samples in one second for both scenarios and RMS about 0.707107. The frequencies are different, but the RMS is the same in this case because the sinusoids have the same amplitude and the section contains a whole number of periods.
Reproducible configurations
Note the actual value of sample_rate, the name of the scenario and the parameters that determine the signal. A type statement does not verify all the physical relationships between parameters alone: those are to be controlled in the program, such as the ratio between signal frequency and sampling frequency.
Exercise
- What is the default sampling rate?
- Why are both scenarios verified before calculating them?
- Why are the two RMS of the test equal?
Worked solution
- 100 Hz.
- To avoid a partial summary when a configuration is incompatible.
- Synusoids have equal amplitude and the sample covers an entire number of periods.
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